此内容没有您所选择的语言版本。
10.4.7. Create and Delete Dynamic Exchange Routes
- 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>
qpid-route [OPTIONS] dynamic add <dest-broker> <src-broker> <exchange> qpid-route [OPTIONS] dynamic del <dest-broker> <src-broker> <exchange>Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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
$ qpid-config -a localhost:10003 add exchange topic fed.topic $ qpid-config -a localhost:10004 add exchange topic fed.topicCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a dynamic exchange route that routes messages from the
fed.topicexchange on the source brokerlocalhost:10004to thefed.topicexchange on the destination brokerlocalhost:10003:qpid-route dynamic add localhost:10003 localhost:10004 fed.topic
$ qpid-route dynamic add localhost:10003 localhost:10004 fed.topicCopy to Clipboard Copied! Toggle word wrap Toggle overflow Internally, this creates a private autodelete queue on the source broker, and binds that queue to thefed.topicexchange on the source broker, using each binding associated with thefed.topicexchange on the destination broker. - 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
$ qpid-route dynamic add localhost:10004 localhost:10003 fed.topicCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Specify the
-doption 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
$ qpid-route -d dynamic add localhost:10004 localhost:10003 fed.topicCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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. - The
delcommand takes the same arguments as theaddcommand. Delete the first exchange route described above:qpid-route dynamic del localhost:10004 localhost:10003 fed.topic
$ qpid-route dynamic del localhost:10004 localhost:10003 fed.topicCopy to Clipboard Copied! Toggle word wrap Toggle overflow Internally, this deletes the bindings on the source exchange for the private queues associated with the message route.