...
A nicer way to view the topology is to use qpid-route route map. The argument to this command is a single broker that serves as an entry point. qpid-route will attempt to recursively find all of the brokers involved in federation relationships with the starting broker and map all of the routes it finds.
...
An exchange route is like a dynamic route except that the exchange binding is statically set at creation time instead of dynamically tracking changes in the network.
When an exchange route is created, a private queue (auto-delete, exclusive) is declared on the source broker. The queue is bound to the indicated exchange with the indicated key and the destination broker subscribes to the queue with a destination of the indicated exchange. Since only one exchange name is supplied, this means that exchange routes require that the source and destination exchanges have the same name.
Static exchange routes are added and deleted using qpid-route route add and qpid-route route del respectively. The following example creates a static exchange route with a binding key of "global.Static exchange routes are added and deleted using qpid-tool route add
and qpid-tool route del
respectively. The following example creates a static exchange route with a binding key of "global.#" on the default topic exchange:
...
No Format |
---|
$ qpid-route route list localhost:10001 localhost:10001 localhost:10002 amq.topic global.# |
Alternatively, the route map feature can be used to view the topology:
No Format |
---|
$ qpid-route route map localhost:10001 Finding Linked Brokers: localhost:10001... Ok localhost:10002... Ok Dynamic Routes: none found Static Routes: localhost:10001(ex=amq.topic) <= localhost:10002(ex=amq.topic) key=global.# |
Queue Routes
Pull vs. Push Routes
qpid-route Summary and Options
Caveats, Limitations, and Things to Avoid
...
This example causes messages delivered to the amq.topic exchange on broker localhost:10002 that have a key that matches global.# (i.e. starts with the string "global.") to be delivered to the amq.topic exchange on broker localhost:10001. This delivery will occur regardless of whether there are any consumers on localhost:10001 that will receive the messages.
Note that this is a uni-directional route. No messages will be forwarded in the opposite direction unless another static route is created in the other direction.
The following diagram illustrates the result, in terms of AMQP objects, of the example static exchange route. In this diagram, the exchanges, both named "amq.topic" exist prior to the creation of the route. The creation of the route causes the private queue, the binding, and the subscription of the queue to the destination to be created.
No Format |
---|
-------------------------------------------------+ +------------------------
localhost:10002 | | localhost:10001
| |
+-------------+ | | +-------------+
| | | | | |
| | global.# ---------------+ | | | |
| amq.topic |-----------> private queue |--------------->| amq.topic |
| | ---------------+ | | | |
| | | | | |
+-------------+ | | +-------------+
| |
| |
-------------------------------------------------+ +------------------------
|
Queue Routes
A queue route causes the destination broker to create a subscription to a pre-existing, possibly shared, queue on the source broker. There's no requirement that the queue be bound to any particular exchange. Queue routes can be used to connect exchanges of different names and/or types. They can also be used to distribute or balance traffic across multiple destination brokers.
Queue routes are created and deleted using the qpid-route queue add and qpid-route queue del commands respectively. The following example creates a static queue route to a public queue called "public" that feeds the amq.fanout exchange on the destination:
Create a queue on the source broker:
No Format |
---|
$ qpid-config -a localhost:10002 add queue public
|
Create a queue route to the new queue
No Format |
---|
$ qpid-route queue add localhost:10001 localhost:10002 amq.fanout public
|
Pull vs. Push Routes
When qpid-route creates or deletes a route, it establishes a connection to one of the brokers involved in the route and configures that broker. The configured broker then takes it upon itself to contact the other broker and exchange whatever information is needed to complete the setup of the route.
The notion of push vs. pull is concerned with whether the configured broker is the source or the destination. The normal case is the pull route, where qpid-route configures the destination to pull messages from the source. A push route occurs when qpid-route configures the source to push messages to the destination.
Dynamic routes are always pull routes. Static routes are normally pull routes but may be inverted by using the src-local
option when creating (or deleting) a route. If src-local
is specified, qpid-route will make its connection to the source broker rather than the destination and configure the route to push rather than pull.
Push routes are useful in applications where brokers are co-resident with data sources and are configured to send data to a central broker. Rather than configure the central broker for each source, the sources can be configured to send to the destination.
qpid-route Summary and Options
No Format |
---|
$ qpid-route
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]
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
|
There are several transport options available for the federation link:
Transport | Description |
---|---|
tcp | (default) A cleartext TCP connection |
ssl | A secure TLS/SSL over TCP connection |
rdma | A Connection using the RDMA interface (typically for an Infiniband network) |
The tag and exclude-list arguments are not needed. They have been left in place for backward compatibility and for advanced users who might have very unusual requirements. If you're not sure if you need them, you don't. Leave them alone. If you must know, please refer to "Message Loop Prevention" in the advanced topics section below. The prevention of message looping is now automatic and requires no user action.
If the link between the two sites has network latency, this can be compensated for by increasing the ack frequency with --ack N to achieve better batching across the link between the two sites.
Caveats, Limitations, and Things to Avoid
Redundant Paths
The current implementation of federation in the M4 broker imposes constraints on redundancy in the topology. If there are parallel paths from a producer to a consumer, multiple copies of messages may be received.
A future release of Qpid will solve this problem by allowing redundant paths with cost metrics. This will allow the deployment of networks that are tolerant of connection or broker loss.
Lack of Flow Control
M4 broker federation uses unlimited flow control on the federation sessions. Flow control back-pressure will not be applied on inter-broker subscriptions.
Lack of Cluster Failover Support
The client functionality embedded in the broker for inter-broker links does not currently support cluster fail-over. This will be added in a subsequent release.
Example Scenarios
Using QPID to bridge disjoint IP networks
Full mesh topology
Multi-tiered topology
No Format |
---|
+-----+ | 5 | +-----+ / \ +-----+ +-----+ | 2 | | 6 | +-----+ +-----+ / | \ | \ +-----+ +-----+ +-----+ +-----+ +-----+ | 1 | | 3 | | 4 | | 7 | | 8 | +-----+ +-----+ +-----+ +-----+ +-----+ |
...