...
AMQP provides the ability to do Point-to-Point, Peer-to-Peer, Pub-Sub, and Eventing. This allows many patterns to be craetedcreated:
Point-to-point
This is one of the simplest use-cases. AMQP allows for this in a few ways.
a.) A client can create a named queue allowing the producer to publish the message to the direct exchange with the key mapping the queue name. This will route the message to that queue.
b.) The above pattern can be extended by specifying a reply-to address in the published messages allowing for the consumer to reply the producer without knowing who it was send sent from prior to receiving the message.
...
a.) AMQP provides a 'fanout' exchange which will send a message to all the queues that have been bound to it. Different domains or topics are created with the 'fanout' exchange by declaring different differently named fan-out exchanges.
b.) A 'topic' or 'headers' exchange can also be used. in In this case the pattern match is used to send the message to all the its bound queues. It can be thought of as a filter allowing you to create just about any One-to-many routing patterns.
...
Topic can be created with the 'topic' or other 'direct' exchange to allow consumer to bind to into the steams of data they care about. This pattern combined with the use of reply-to and Alternate-routing is the a staple of what most people use messaging for today.
...
AMQP supports two types of transactions in AMQP 0-10, TX and DTX. This allows for both local (1PC) , and 2PC transaction transactions and the ability to coordinate with a TM (Transaction Manager). The Java broker supports TX , while the C++ broker support supports TX, DTX, XA, JTA for fully ACID transactions. This allows you to commit a single unit of work with which may contain enqueues & dequeues either locally on the broker, or in coordination with other transactional resource like RDBMS.
...
By default messages are transient. Transient message messages can be sent to queues that are durable. They will not be safe stored or recovered, and will perform as any other transient message - fast!
...
As AMQP 0-10 is symmetric for peer-to-peer communication all the building block blocks are in place for creating networks of brokers. The C++ broker allows you to link the brokers together using 'qpid-route' and then create routes between the brokers either statically or with dynamic routes.
This allows for a message to be published to one broker and consumed from another broker in the federated broker network. This feature is great to create for creating data-centercenters, or for project isolation , but allow while allowing cross communication. It also allows networks to be created to scaledscale upon demand. For more details see
And many others, including custom patternpatterns
Message Reply, Rings, Initial Value Caches, Last Value Messaging
All the above cases can be constructed using the AMQP and features of Qpid. For example reply can be constructed using message browsing and setting TTL on the messages. The C++ broker also support supports ring queues, last value queues, and initial value caches on exchanges. With a bit of throught thought many additional patterns can be constructed.
...
Store-and-forward can be achieved by publishing to well know known durable queues , that are not marked with auto-delete. Consumers will be able to 'came back' to consume then them at any time, even after restarts.
...
In additional the C++ broker supportsupports
- XML Exchange - Query routing
- Custom exchange via plug-in.
...
What encryption does Qpid support?
- Qpid support supports SSL/TSL as per the AMQP specification.
- In addition the C++ broker supports Kerberos encryption of messages independent on of which transport is used. Support in not yet included in for all clients for this but is in processprogress.
What authentication does Qpid support?
SASL Authentication is supported. All Clients clients support PLAIN, and Kerberos support if being added to all the clients. The C++ broker support supports Kerberbos authentication.
...
ACL supports realms and allows for granular permission to be set on all the broker actions including management on an user or group basis.
How to setup Kerberos with the Java client
You could force the java client can force Java clients to use kerberos auth Kerberos authentication by specifying it in the connection URL as follows.
Code Block |
---|
amqp://guest:guest@clientid/testpath?brokerlist='tcp://localhost:5672?'&sasl_mechs='GSSAPI' |
You would then will also need to pass in the following jvm JVM arguments:
Code Block |
---|
-Djavax.security.auth.useSubjectCredsOnly=false # (This will force the SASL GASSPI client to obtain the kerberosKerberos credentials explicitly instead of obtaining from the "subject" that owns the currents thread) -Djava.security.auth.login.config=myjas.conf (this specifies the jass config file) -Dsun.security.krb5.debug=true (to enable detailed debug info for troubleshooting) |
Before running the java Java client you would 'll need to do kinit and grab a kerberos Kerberos ticket. Alternative Alternatively you could can set useTicketCache=false and when the client loads, it will prompt you for the user/pass and will obtain the a ticket for you.
(You would 'll also need to setup your kerberos Kerberos environment properly -refer to doc links below).
...
I want to be able to have an exclusive consumer, but when it dies I want another to be able to pick up the queue and then block others, can this be done?
Yes, Declare you declare your queue exclusive. this This will prevent anyone else from connecting to the queue. If the consumer dies the next consumer can attach to the queue by redeclaring it using the exclusive flag. Make sure not to set auto-delete. Any consumer trying to declare , a queue exclusive while a another consumer is already attached to the queue will receive an exception.
...
Once the session that held the consumer is closed.
Performance
Does Qpid
...
perform well (Latency/Throughput)?
Yes, The Qpid C++ broker has been achieved great benchmark results in published papers by those that redistribute it. The Red Hat MRG product build built on Qpid has shown 760,000msg/sec ingress on an 8 way box or 6,000,000msg/sec OPRA messages.
Latencies have been recored recorded as low as 180-250us (.18ms-.3ms) for TCP round trip and 60-80us for RDMA round trip using the C++ broker.
...
There is a great resource supplied in the C++ broker test directory called perftest. If It allows you to create a load on a broker for all the exchanges, multiple queues, multiple connectionconnections, coordinate multiple publishing and consuming processes, beachmark benchmark transactions and much much more such as acquire mode, txn size, message size, etc.
For To see all the available options
Code Block |
---|
./perftest --help |
...
There is a great resource supplied in the C++ broker test directory called latencytest. It is a loopback test that produces messages by count or at a rate, time stamps timestamps them and then consumes them back and record records the latency. It supports many of the Qpid options, including the ability to vary things like frame-size.
...
- 1G TCP ~ .3ms -.5ms
- 10G TCP - .18ms - .22ms
- RDMA transport - 40us - 80us
Don't forget to set tune the machine and set --tcp-nodelay on both the C++ broker & client.
...
Does Qpid support flow control?
yesYes, AMQP 0-10 allows for flow control on the consumer and producer.
...
Code Block |
---|
--max-session-rate MESSAGES/S (0) Sets the maximum message rate per session (0=unlimited) |
Management
What Management options does Qpid support?
The Java broker supports JMX and provides an Eclipse plug-in and command line tool to manage via JMX. The C++ broker has far more extensive management support via QMF which will be added to the Java broker in a future release.
The C++ Broker supports a layered management protocol over AMQP called QMF. This allows for the management of resource resources either in the broker or connected to the broker via the AMQP fabric. This management includes statistics, control, eventing, and reporting/updating properties.
...
- qpid-tool - telnet type tool to access data, view schema, issue command an and and issue commands on a QMF resource
- qpid-config - tool to configure queues, exchanges, etc. all the details on using the AMQP model
- qpid-route - tool to configure broker federation
- qpid-events - utility that will print to cmd the command line or syslog event from a broker like, userconnected, user crested/deleted a queuesystem log broker events such as users connected, users creating/deleting a queue, etc.
- qpid-stats - utility that will print out queue statistics to the cmd command line or syslog a system log like rate and message depth.
Then you can also access all thsi this information via JMX or WS-DM (work in progress) using QMan.
What logging tracing and events does Qpid support?
Qpid support supports the ability to output events from any the broker or any managed object via QMF, or to do a variety of logging from the broker & and clients. for To see tracing options run qpidd --help.
Multiple levels of of logging are supported in the C++ broker from debug, warning, error, info, etc – all of which can be further filtered.
Can I
...
see all the management data from a client?
yesYes, All the all management data is consists of just AMQP messages on specially named queues. An API is provided for working with the management data called QMFC is provided.
What is QMF
QMF is the layered Management protocol used to manage the C++ broker. For details on teh this protocol see the Development pages.
QMF allows you to manage any resource and provides the following infrsstructureinfrastructure:
- Properties
- Statistics
- Commands
- Events
- Schema for resources and versioning
- tools for creating agents and consuming QMF data.
...
An Agent is any client (producer or consumer) that generates a QMF schema and registers itself to be management managed by QMF.
A great use case of this is a consumer that is processing order orders from a queue can reference itself to that queue and for example provide a schema for the number or successful orders process processed and a method to suspend processing. Now it becomes possible to use qpid-tool to connect to the broker, see which order processors are on queue via the reference and the via the stats of the order processor client. It is also possible to issue a command to the client via qpid-tool to suspend processing. An ACL in the broker can be applied to all these actions if desired.
...
The C++ broker has plug-ins for Active-Active clustering which keep keeps all the nodes of the cluster in sync. This means that any action that is performed on one of the brokers on the cluster is performed on all of them at the same time. New nodes can be added to the cluster at any time, and removed at any time with no consequences, exept except for the extra multi-cast load created for the sync on joining.
How do I start a fault tolerant cluster?
How do I avoid "split-brain" syndrome in a Qpid cluster.
See Configuring qpidd with Cluster Manager
What does the cluster guarantee?
...
Do clients get notified members joining or leaving the cluster?
yesYes, All all clients are updated with the addresses of node add/removed as supported by the AMQP 0-10 specification. This means that the client can dynamically track the nodes in the cluster and reconnect as required.
Can I specify more than one host to connect initially to the cluster to avoid single point of failure?
yesYes, the AMQP address is multi-honed homed and more than one IP address can be specified at the initial connection. The client will then iterate through the host hosts until it makes a successful connection. This feature can also be used in none non-clustered brokers.
How does Clustering work?
...
Every action that is performed on any node of the cluster is then sequenced via totem and then performed on each node of the cluster in sync. As the cluster backbone is multicast, a separate network can be used for cluster communication and there is little impact adding additional nodes to the cluster with-in within reason.
What is Federation?
Federation provides the ability to create networks of brokers that communicate with each other in all types of typologies. This allows a producer to publish messages to one broker and someone to consume the messages from another broke broker somewhere on the broker federated network.
...
Disaster recovery features are in process, Q&A will be added once they are complete.
Heartbeats
Heartbeat can be configured to allow clients to detect when a broker has failed and connect to another broker or cluster member. Heartbeats are sent by the broker at a client specified, per-connection frequency. If the client does not receive a heartbeat or any other traffic for two heartbeat intervals, the connection will be made to fail.
...
If there is no traffic for two heartbeat intervals, the client will fail the connection. The application will see the exact same response as when if the connection is were killed.
What happens if the broker is unable to send heartbeat?
...
Then make sure that the interfaces on each broker are reachable from the host you run my the clients, else it will take a long time for the socket to timeout until it gets to one that can be reached.
Make sure the list of URL's on the cient client are the ones you want tht the client to try
Make sure that the broker is only exporting URL's that the client can connect to, use the --cluster-url option on the broker to specify this.
...
The broker uses IO threads for all the work it does. This means that when work is signalled via an event (socket, RDMA, timer) an IO thread is scheduled and it runs until it completes the work and then returns back to the IO thread pool. This allows the CPUs to be utilized efficiently. The general rule is that we allocate 1 thread per core +1. So on a 8 way machine you'll see worker-threads default to 9. On a 4 way it will be 5. Sometimes it if work changing 's useful to change the default allocation if for example:
a.) you run on high core count machine >8 (more than 8 cores) to a lower number
b.) if you taskset, then set to the cores allocated +1
...
Concurrency in the broker is at the session level. So yes. If , so if you want more concurrency , create another session on the same connection.
How are worker threads allocated to individual client sessions if there are more clients than threads in the pool?
They Threads are not allocated to a specific clientclients.
Persistence
Does Qpid support persistence (durability)?
...
The terms durable and persistent are used interchangeably in this FAQ.
Where do I get the 3rd party
...
persistent store modules?
The 3rd party persistence persistent store modules may be obtained through anonymous subversion Subversion at the following locations:
...
For further details see 3rd Party Libraries
How do I build
...
a persistent store module from subversion checkouts?
C*++*The README file contains detailed instructions, but here is a summary:
- Make sure that both the db4-devel and libaio-devel packages are installed prior to building.
- Make sure that qpid is built and you know the location of the qpid directory (ie i.e., the top-level directory containing the python and cpp sub-directories).
- In the store directory, run:
Code Block ./bootstrap ./configure --with-qpid-checkout=/abs/path/to/qpid/dir make
- When built, the store library msgstore.so will be located in the lib/.libs directory.
...
Which version of the store should I use when building against qpid 0.X?
C++
If you build qpid from svn Qpid from the head revision of the SVN trunk, you should be able to build the store against it using the store's head revision on its trunk. However, if you build the store from a released version of qpid, you will need to check out a specific version of the store to get it to compile, or use one of the following svn tags:
release | store tag | store trunk revision | branch |
---|---|---|---|
0.5 | qpid-0.5-release | 3373 |
|
0.6 | qpid-0.6-release | 3793 |
|
0.8 | qpid-0.8-release | 4411 |
|
0.10 | qpid-0.10-release | 4446 |
|
0.12 | qpid-0.12-release | 4463 |
|
0.14 | qpid-0.14-release | 4490 |
|
0.16 | qpid-0.16-release | 4509 |
|
0.18 |
|
| qpid-0.18 |
To check out To check out revision revno, use:
Code Block |
---|
svn co http://anonsvn.jboss.org/repos/rhmessaging/store/trunk/cpp -r [revno[revno] [local-dir-name] |
To check out tag tagname, use:
Code Block |
---|
svn co http://anonsvn.jboss.org/repos/rhmessaging/store/tags/[tagname] [local-dir-name]
|
To check out tag tagname
branch branchname, use:
Code Block |
---|
svn co http://anonsvn.jboss.org/repos/rhmessaging/store/tagsbranches/[tagname]/cpp[branchname] [local-dir-name] |
JavaTODO
How do I use
...
a persistent store module?
C++
- Start the broker making sure that the store module is loaded, ie
Code Block qpidd --load-module=/path/to/msgstore.so --data-dir=/path/to/store-files ...
- Make sure that queues that will handle persistent messages are set durable.
Note title Note: Existing non-persistent queues cannot be made persistent If a queue has been declared without persistence, doing so again with persistence enabled while the old queue still exists in the broker will be ignored. Make sure that when a queue is declared persistent, there is no non-persistent queue of the same name in existence.
- For each message sent to a durable queue, make sure that it is set durable.
JavaTODO
How do I configure
...
a persistent store?
C++
The broker loads help information from each module. To see the help options for the store, load the store module and specify help:
...
For details of using the 3rd party persistent modules see here
...
...
[C+
...
+
...
store
...
]
...
What
...
is
...
a
...
RHM_IORES_ENQCAPTHRESH
...
error?
The journal ran out of space (ENQueue CAPacity THRESHold). The journal is a circular file buffer of fixed capacity set by the journal file size and number of files. When an attempt to write a record causes the journal to exceed an approx. 80% threshold, then the enqueue is rejected with this error code. Dequeues (a written record of a consumed message) may continue, however, as these free up space in the journal. Once space has been freed up, enqueues may continue as normal.
...
- The journal is too small for the size and number of messages being stored. The journal must be made large enough to hold all of the messages you expect to be on the queue at any one moment (a worst-case scenario). Make the journal capacity larger through the use of the --num-jfiles and --jfile-size-pgs parameters.
Info title Rule of thumb for sizing the journal Make the journal twice the size of all the messages you need to store at any one moment in time.
- Messages are not being dequeued (consumed) as expected. Since the store is a circular file buffer, if one un-dequeued (not consumed) message remains, it can eventually "block" the storage of new messages as the buffer gets overwritten.
...
...
[C+
...
+
...
store
...
]
...
What
...
is
...
the
...
TPL?
...
What
...
are
...
the
...
--tpl
...
-
...
*
...
options
...
for?
The TPL stands for Transaction Prepared List. The store creates a single instance of a store journal for storing transaction boundaries called the Transaction Prepared List. Because the TPL is frequently flushed and has very different usage patterns to a normal store, it has been provided with its own set of configuration parameters:
...
- IP over IB or Fibre needs to be setup for the initial negociationnegotiation
- You need to make sure you have enough memory to pin for DMA use ulimit -l something large
- you might need to edit /etc/security/limits.conf first then log in again
...
I need to be able to set time for a message that I send to be removed from the queue if it is not read by my subscriber. For example: I enqueue a message and I want it to be automatically dequeued after a certain amount of time has passed. Is there a feature like this in qpidQpid?
yesYes, the TTL can be set in the message headers and the messages get dequeued if TTL expires
...
This problem occurs because the PYTHONPATH environment variable does not include the location of the qpid python Qpid Python files. If you are running from the SVN checkout, add <path>/qpid/python to PYTHONPATH (where <path> is the location of your SVN tree). If you are installing from source, make sure you configure with the same prefix where Python is installed. This is most likely:
...
If you are running from vendor RPMs, this should work automatically.
Java
Children Display | ||
---|---|---|
|