Commit fe7376e3 authored by Edlira Nano's avatar Edlira Nano
Browse files

qpid first client + listener version

git-svn-id: https://subversion.renater.fr/masschroq/trunk@2070 e4b6dbb4-9209-464b-83f7-6257456c460c
parent 9672a0df
***********Installation Qpid**********************************
Prendre le qpid-0.8.tar.gz Full source release sur le site.
Le détarer où vous voulez.
sudo apt-get install python-dev gcc ruby-dev libperl-dev libboost-all-dev uuid-dev doxygen libsasl2-dev libnss3-dev librdmacm-dev
***** Surtout ne pas installer libxerces-c : bug et si c'est déjà installé sur votre ordi le virer.
dans qpid-0.8/cpp faire :
./bootstrap
./configure --prefix=/usr
ou --prefix=/usr/local/
ou ce que vous voulez, mais il faut s'en rappeller parce qu'après faudra installer les autres clients au même endroit. Je vais appeller ça le rep. d'installation par la suite.
sudo make install
Si pb pendant le make m'appeller, j'en ai eu un à un moment que j'ai résolu mais je sais pas trop expliquer à quoi c'était du.
tester si le broker marche :
qpidd
Si erreur m'appeller, moi ça marchait pas parce que j'ai installé ça dans /usr/local/ et il a fally que j'ajoute le /usr/local/lib dans mon LD path (j'ai fait ça en allant dans /usr/local/lib et en tapant sudo ldconfig)
Maintenant on va installer des tools et des extras pour manager le broker, youpi :
cd qpid-0.8/python
sudo python setup.py install --prefix=votre rep. d'install
cd qpid-0.8/extras
pareil (sudo python setup.py...)
cd qpid-0.8/tools
pareil
Pour tester, avec le broker lancé (qpidd):
qpid-config
Si pas d'erreur, c'est bon, vous avez réussi, trop fort :)
Usage: qpid-config [OPTIONS]
qpid-config [OPTIONS] exchanges [filter-string]
qpid-config [OPTIONS] queues [filter-string]
qpid-config [OPTIONS] add exchange <type> <name> [AddExchangeOptions]
qpid-config [OPTIONS] del exchange <name>
qpid-config [OPTIONS] add queue <name> [AddQueueOptions]
qpid-config [OPTIONS] del queue <name> [DelQueueOptions]
qpid-config [OPTIONS] bind <exchange-name> <queue-name> [binding-key]
<for type xml> [-f -|filename]
<for type header> [all|any] k1=v1 [, k2=v2...]
qpid-config [OPTIONS] unbind <exchange-name> <queue-name> [binding-key]
Options:
--timeout seconds (10) Maximum time to wait for broker connection
-b [ --bindings ] Show bindings in queue or exchange list
-a [ --broker-addr ] Address (localhost) Address of qpidd broker
broker-addr is in the form: [username/password@] hostname | ip-address [:<port>]
ex: localhost, 10.1.1.7:10000, broker-host:10000, guest/guest@localhost
Add Queue Options:
--alternate-exchange [name of the alternate exchange]
The alternate-exchange field specifies how messages on this queue should
be treated when they are rejected by a subscriber, or when they are
orphaned by queue deletion. When present, rejected or orphaned messages
MUST be routed to the alternate-exchange. In all cases the messages MUST
be removed from the queue.
--passive Do not actually change the broker state (queue will not be created)
--durable Queue is durable
--cluster-durable Queue becomes durable if there is only one functioning cluster node
--file-count N (8) Number of files in queue's persistence journal
--file-size N (24) File size in pages (64Kib/page)
--max-queue-size N Maximum in-memory queue size as bytes
--max-queue-count N Maximum in-memory queue size as a number of messages
--limit-policy [none | reject | flow-to-disk | ring | ring-strict]
Action taken when queue limit is reached:
none (default) - Use broker's default policy
reject - Reject enqueued messages
flow-to-disk - Page messages to disk
ring - Replace oldest unacquired message with new
ring-strict - Replace oldest message, reject if oldest is acquired
--order [fifo | lvq | lvq-no-browse]
Set queue ordering policy:
fifo (default) - First in, first out
lvq - Last Value Queue ordering, allows queue browsing
lvq-no-browse - Last Value Queue ordering, browsing clients may lose data
--generate-queue-events N
If set to 1, every enqueue will generate an event that can be processed by
registered listeners (e.g. for replication). If set to 2, events will be
generated for enqueues and dequeues
Del Queue Options:
--force Force delete of queue even if it's currently used or it's not empty
--force-if-not-empty Force delete of queue even if it's not empty
--force-if-used Force delete of queue even if it's currently used
Add Exchange <type> values:
direct Direct exchange for point-to-point communication
fanout Fanout exchange for broadcast communication
topic Topic exchange that routes messages using binding keys with wildcards
headers Headers exchange that matches header fields against the binding keys
Add Exchange Options:
--alternate-exchange [name of the alternate exchange]
In the event that a message cannot be routed, this is the name of the exchange to
which the message will be sent. Messages transferred using message.transfer will
be routed to the alternate-exchange only if they are sent with the "none"
accept-mode, and the discard-unroutable delivery property is set to false, and
there is no queue to route to for the given message according to the bindings
on this exchange.
--passive Do not actually change the broker state (exchange will not be created)
--durable Exchange is durable
--sequence Exchange will insert a 'qpid.msg_sequence' field in the message header
with a value that increments for each message forwarded.
--ive Exchange will behave as an 'initial-value-exchange', keeping a reference
to the last message forwarded and enqueuing that message to newly bound
queues.
Usage: qpid-route [OPTIONS] dynamic add <dest-broker> <src-broker> <exchange> [tag] [exclude-list]
qpid-route [OPTIONS] dynamic del <dest-broker> <src-broker> <exchange>
qpid-route [OPTIONS] route add <dest-broker> <src-broker> <exchange> <routing-key> [tag] [exclude-list] [mechanism]
qpid-route [OPTIONS] route del <dest-broker> <src-broker> <exchange> <routing-key>
qpid-route [OPTIONS] queue add <dest-broker> <src-broker> <exchange> <queue>
qpid-route [OPTIONS] queue del <dest-broker> <src-broker> <exchange> <queue>
qpid-route [OPTIONS] route list [<dest-broker>]
qpid-route [OPTIONS] route flush [<dest-broker>]
qpid-route [OPTIONS] route map [<broker>]
qpid-route [OPTIONS] link add <dest-broker> <src-broker>
qpid-route [OPTIONS] link del <dest-broker> <src-broker>
qpid-route [OPTIONS] link list [<dest-broker>]
Options:
--timeout seconds (10) Maximum time to wait for broker connection
-v [ --verbose ] Verbose output
-q [ --quiet ] Quiet output, don't print duplicate warnings
-d [ --durable ] Added configuration shall be durable
-e [ --del-empty-link ] Delete link after deleting last route on the link
-s [ --src-local ] Make connection to source broker (push route)
--ack N Acknowledge transfers over the bridge in batches of N
-t <transport> [ --transport <transport>]
Specify transport to use for links, defaults to tcp
dest-broker and src-broker are in the form: [username/password@] hostname | ip-address [:<port>]
ex: localhost, 10.1.1.7:10000, broker-host:10000, guest/guest@localhost
Usage: qpidd [OPTIONS]
Options:
-h [ --help ] Displays the help message
-v [ --version ] Displays version information
--config FILE (etc/qpid/qpidd.conf) Reads configuration from FILE
Module options:
--module-dir DIR (lib/qpid/daemon) Load all shareable modules in this
directory
--load-module FILE Specifies additional module(s) to be
loaded
--no-module-dir Don't load modules from module directory
Broker Options:
--data-dir DIR (/home/enano/.qpidd) Directory to contain persistent data
generated by the broker
--no-data-dir Don't use a data directory. No
persistent configuration will be loaded
or stored
-p [ --port ] PORT (5672) Tells the broker to listen on PORT
--worker-threads N (5) Sets the broker thread pool size
--max-connections N (500) Sets the maximum allowed connections
--connection-backlog N (10) Sets the connection backlog limit for
the server socket
-m [ --mgmt-enable ] yes|no (1) Enable Management
--mgmt-qmf2 yes|no (0) Use QMF v2 for Broker Management
--mgmt-pub-interval SECONDS (10) Management Publish Interval
--queue-purge-interval SECONDS (600) Interval between attempts to purge any
expired messages from queues
--auth yes|no (1) Enable authentication, if disabled all
incoming connections will be trusted
--realm REALM (QPID) Use the given realm when performing
authentication
--default-queue-limit BYTES (104857600)
Default maximum size for queues (in
bytes)
--tcp-nodelay Set TCP_NODELAY on TCP connections
--require-encryption Only accept connections that are
encrypted
--known-hosts-url URL or 'none' URL to send as 'known-hosts' to clients
('none' implies empty list)
--sasl-config FILE gets sasl config from nonstandard
location
--max-session-rate MESSAGES/S (0) Sets the maximum message rate per
session (0=unlimited)
--async-queue-events yes|no (0) Set Queue Events async, used for
services like replication
Logging options:
-t [ --trace ] Enables all logging
--log-enable RULE (notice+) Enables logging for selected levels and
components. RULE is in the form
'LEVEL[+][:PATTERN]' Levels are one of:
trace debug info notice warning error
critical
For example:
'--log-enable warning+' logs all
warning, error and critical messages.
'--log-enable debug:framing' logs debug
messages from the framing namespace.
This option can be used multiple times
--log-time yes|no (1) Include time in log messages
--log-level yes|no (1) Include severity level in log messages
--log-source yes|no (0) Include source file:line in log
messages
--log-thread yes|no (0) Include thread ID in log messages
--log-function yes|no (0) Include function signature in log
messages
--log-prefix STRING Prefix to append to all log messages
Logging sink options:
--log-to-stderr yes|no (1) Send logging output to stderr
--log-to-stdout yes|no (0) Send logging output to stdout
--log-to-file FILE Send log output to FILE.
--log-to-syslog yes|no (0) Send logging output to syslog;
customize using --syslog-name and
--syslog-facility
--syslog-name NAME (qpidd) Name to use in syslog messages
--syslog-facility LOG_XXX (LOG_DAEMON)
Facility to use in syslog messages
Daemon options:
-d [ --daemon ] Run as a daemon. Logs to syslog by
default in this mode.
--transport TRANSPORT (tcp) The transport for which to return the
port
--pid-dir DIR (/home/enano/.qpidd) Directory where port-specific PID file is
stored
-w [ --wait ] SECONDS (600) Sets the maximum wait time to initialize
the daemon. If the daemon fails to
initialize, prints an error and returns 1
-c [ --check ] Prints the daemon's process ID to stdout
and returns 0 if the daemon is running,
otherwise returns 1
-q [ --quit ] Tells the daemon to shut down
gcc -Wall -o masschroq_listener.o -c masschroq_listener.cpp;
gcc -o m_listener -lqpidmessaging masschroq_listener.o
#include <qpid/messaging/Connection.h>
#include <qpid/messaging/Message.h>
#include <qpid/messaging/Receiver.h>
#include <qpid/messaging/Sender.h>
#include <qpid/messaging/Session.h>
#include <iostream>
using namespace qpid::messaging;
int main(int argc, char** argv) {
std::string broker = argc > 1 ? argv[1] : "localhost:5672";
std::string address = argc > 2 ? argv[2] : "amq.topic";
std::string connectionOptions = argc > 3 ? argv[3] : "";
Connection connection(broker, connectionOptions);
try {
connection.open();
Session session = connection.createSession();
Receiver receiver = session.createReceiver(address);
while (true) {
Message message = receiver.fetch();
std::cout << message.getContent() << std::endl;
session.acknowledge();
}
connection.close();
return 0;
} catch(const std::exception& error) {
std::cerr << error.what() << std::endl;
connection.close();
return 1;
}
}
gcc -Wall -o masschroq_sender.o -c masschroq_sender.cpp;
gcc -o m_sender -lqpidmessaging masschroq_sender.o
#include <qpid/messaging/Address.h>
#include <qpid/messaging/Connection.h>
#include <qpid/messaging/Message.h>
#include <qpid/messaging/Receiver.h>
#include <qpid/messaging/Sender.h>
#include <qpid/messaging/Session.h>
#include <cstdlib>
#include <iostream>
#include <sstream>
using namespace qpid::messaging;
using std::stringstream;
using std::string;
int main(int argc, char** argv) {
std::string broker = argc > 1 ? argv[1] : "localhost:5672";
std::string address = argc > 2 ? argv[2] : "amq.topic";
std::string connectionOptions = argc > 3 ? argv[3] : "";
Connection connection(broker, connectionOptions);
try {
connection.open();
Session session = connection.createSession();
Sender sender = session.createSender(address);
Message message;
message.setContent
(
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"
"<masschroq>\n"
"<rawdata>\n"
"<data_file id=\"samp0\" format=\"mzxml\" path=\"Bsa_old.mzXML\" type=\"centroid\"/>\n"
"<data_file id=\"samp1\" format=\"mzxml\" path=\"bsa_1.mzXML\" type=\"centroid\"/>\n"
"</rawdata>\n"
"<groups>\n"
"<group data_ids=\"samp0 samp1\" id=\"G1\"/>\n"
"</groups>\n"
"<peptide_files_list>\n"
"<peptide_file data=\"samp0\" path=\"/home/enano/Desktop/quantiTestsMin/scanTests/Bsa_old_peptide_list.txt\"/>\n"
"<peptide_file data=\"samp1\" path=\"/home/enano/Desktop/quantiTestsMin/scanTests/bsa_1_peptide_list.txt\"/>\n"
"</peptide_files_list>\n"
"<alignments>\n"
"<alignment_methods>\n"
"<alignment_method id=\"ms2_1\">\n"
"<ms2>\n"
"<ms2_tendency_halfwindow>10</ms2_tendency_halfwindow>\n"
"<ms2_smoothing_halfwindow>5</ms2_smoothing_halfwindow>\n"
"<ms1_smoothing_halfwindow>0</ms1_smoothing_halfwindow>\n"
"</ms2>\n"
"</alignment_method>\n"
"</alignment_methods>\n"
"<align group_id=\"G1\" method_id=\"ms2_1\" reference_data_id=\"samp0\"/>\n"
"</alignments>\n"
"<quantification_methods>\n"
"<quantification_method id=\"qzivy1\">\n"
"<xic_extraction xic_type=\"sum\">\n"
"<mz_range max=\"1.5\" min=\"0.5\"/>\n"
"</xic_extraction>\n"
"<xic_filters>\n"
"<background half_mediane=\"5\" half_min_max=\"15\"/>\n"
"</xic_filters>\n"
"<peak_detection>\n"
"<detection_zivy>\n"
"<minmax_half_edge>3</minmax_half_edge>\n"
"<maxmin_half_edge>2</maxmin_half_edge>\n"
"<detection_threshold_on_max>5000</detection_threshold_on_max>\n"
"<detection_threshold_on_min>3000</detection_threshold_on_min>\n"
"</detection_zivy>\n"
"</peak_detection>\n"
"</quantification_method>\n"
"</quantification_methods>\n"
"<quantification>\n"
"<quantification_results>\n"
"<quantification_result output_file=\"peps_test_scan_align_no\" format=\"tsv\"/>\n"
"</quantification_results>\n"
"<quantification_traces>\n"
"<all_xics_traces output_dir=\"peps_xics_traces\" format=\"tsv\"/>\n"
"</quantification_traces>\n"
"<quantify id=\"q1\" withingroup=\"G1\" quantification_method_id=\"qzivy1\">\n"
"<peptides_in_peptide_list mode=\"real_or_mean\"/>\n"
"</quantify>\n"
"</quantification>\n"
"</masschroq>\n"
);
sender.send(message);
connection.close();
return 0;
} catch(const std::exception& error) {
std::cout << error.what() << std::endl;
connection.close();
}
return 1;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment