10.4.7. Create and Delete Dynamic Exchange Routes

  1. To create and delete dynamic exchange routes, use the following syntax:
    qpid-route [OPTIONS] dynamic add <dest-broker> <src-broker> <exchange> 
    qpid-route [OPTIONS] dynamic del <dest-broker> <src-broker> <exchange>
    
  2. Create a new topic exchange on each of two brokers:
    $ qpid-config -a localhost:10003 add exchange topic fed.topic
    $ qpid-config -a localhost:10004 add exchange topic fed.topic
    
  3. Create a dynamic exchange route that routes messages from the fed.topic exchange on the source broker localhost:10004 to the fed.topic exchange on the destination broker localhost:10003:
    $ qpid-route dynamic add localhost:10003 localhost:10004 fed.topic
    
    Internally, this creates a private autodelete queue on the source broker, and binds that queue to the fed.topic exchange on the source broker, using each binding associated with the fed.topic exchange on the destination broker.
  4. In many applications, messages published to the destination exchange must also be routed to the source exchange. Create a second dynamic exchange route, reversing the roles of the two exchanges:
    $ qpid-route dynamic add localhost:10004 localhost:10003 fed.topic
    
  5. Specify the -d option to persist the exchange route. The exchange route will be restored if one or both of the brokers is restarted:
    $ qpid-route -d dynamic add localhost:10004 localhost:10003 fed.topic
    
    When an exchange route is durable, the private queue used to store messages for the route on the source exchange is also durable. If the connection between the brokers is lost, messages for the destination exchange continue to accumulate until it can be restored.
  6. The del command takes the same arguments as the add command. Delete the first exchange route described above:
    $ qpid-route dynamic del localhost:10004 localhost:10003 fed.topic
    
    Internally, this deletes the bindings on the source exchange for the private queues associated with the message route.