[rabbitmq-discuss] dynamic binding

PATAR, SAGAR sp345s at att.com
Tue Apr 29 21:36:25 BST 2014

I am using the below code and it is creating the binding object BUT is NOT reflecting on the admin console.. Attaching the src and context file for reference ..

Binding b = BindingBuilder.bind(q).to(e).with(binding.getRoutingKey()).and(bArgs);

Below is the configuration context file ...

<rabbit:connection-factory id="connectionFactory" connection-factory="cf" addresses="${addresses}" channel-cache-size="${session.size}" />
        <rabbit:admin id="admin" connection-factory="connectionFactory" />
        <!-- Message Listener 1 ### Exchange -    -->
        <rabbit:queue id="queue1" name="${username}.${jndiname1}.QUEUE" durable="true" auto-delete="false" />
<rabbit:headers-exchange name="${jndiname1}"/>
   <bean name="binding1"  class="org.springframework.amqp.rabbit.config.BindingFactoryBean">
        <property name="exchange" value="${jndiname1}" />
        <property name="destinationQueue" ref="queue1" />
                <property name="arguments">
                        <entry key="x-match" value="any" />
        <bean id="listener1" class="${listener1}"/>
<rabbit:listener-container id="dlListenerContainer" concurrency="${listener.thread.size}"
                <rabbit:listener ref="listener1"  queues="queue1" />

From: rabbitmq-discuss [mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com] On Behalf Of Gary Russell
Sent: Monday, April 28, 2014 12:09 PM
To: Discussions about RabbitMQ
Subject: Re: [rabbitmq-discuss] dynamic binding

Yes; just add a second binding with the new header value(s); no need to do anything on the listener - it's all a function of the rabbitmq-server.

On Mon, Apr 28, 2014 at 11:01 AM, PATAR, SAGAR <sp345s at att.com<mailto:sp345s at att.com>> wrote:

We are using header exchanges and are using spring-rabbit mq for configuration and binding listeners to listen to specific messages with specific message header values.
Ex: message header "srcId" has values "1001,1002,1003,1004"

At runtime if the same listener bean has to listen to messages with message header "srcId" having value "2001,2002,2003" ..
Is there a way to add these bindings dynamically at runtime ..??


rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com<mailto:rabbitmq-discuss at lists.rabbitmq.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140429/3f66c288/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BindingBean.java
Type: application/octet-stream
Size: 3944 bytes
Desc: BindingBean.java
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140429/3f66c288/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: amqp-rabbitmq-consumer.xml
Type: text/xml
Size: 4548 bytes
Desc: amqp-rabbitmq-consumer.xml
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140429/3f66c288/attachment.xml>

More information about the rabbitmq-discuss mailing list