IMHO the most powerful aspects of AMQP 0.10 is the concepts of exchanges and routing/binding keys and the flexibility that these features provide when building messaging solutions.
To use an AMQP 0.10 address in camel just specify it as you would in a normal java application.
For example, the following route will create an auto-delete queue on the default exchange
<route id="ampqIN">
<from uri="amqp:queue:TestQueueIN;{create:always,node:{x-declare:{auto-delete:True}}}?concurrentConsumers=1&jmsKeyFormatStrategy=passthrough"/>
<log message="The current message contains ${headers} ${body}"/>
<to uri="amqp:topic:amq.topic?concurrentConsumers=1&jmsKeyFormatStrategy=passthrough"/>
</route>
The following example specifies an address using an exchange/subject pair
<camelContext trace="false" id="blueprintContext"
xmlns="http://camel.apache.org/schema/blueprint">
<route id="ampqIN">
<from
uri="amqp:queue:nocexc/TestQueueIN?concurrentConsumers=1&jmsKeyFormatStrategy=passthrough" />
<log message="The current message contains ${headers} ${body}" />
<to
uri="amqp:queue:TestExchange/?concurrentConsumers=1&jmsKeyFormatStrategy=passthrough" />
</route>
</camelContext>
You can also specify the exchange & routing keys using multiple formats:
<!-- <to uri="amqp:queue:BURL:fanout://TestExc//Boing?concurrentConsumers=1&jmsKeyFormatStrategy=passthrough"/>-->
<to uri="amqp:queue:testq;{create:never,node:{type:queue,durable:True,x-bindings:[{exchange: TextExc}]}}?concurrentConsumers=1&jmsKeyFormatStrategy=passthrough"/>
No comments:
Post a Comment