[rabbitmq-discuss] dynamic binding

Gary Russell grussell at gopivotal.com
Tue Apr 29 21:50:14 BST 2014


It looks like you are trying to modify an existing binding; I said...

>add a second binding with the new header value(s)...

Just use admin.declareBinding(newBinding),

...ending up with 2 bindings on the exchange, with the initial binding
having the 1xxx matches and the new binding having the 2xxx matches.





On Tue, Apr 29, 2014 at 4:36 PM, PATAR, SAGAR <sp345s at att.com> wrote:

>  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">
>
>                 <util:map>
>
>                         <entry key="x-match" value="any" />
>
>                 </util:map>
>
>         </property>
>
>    </bean>
>
>         <bean id="listener1" class="${listener1}"/>
>
> <rabbit:listener-container id="dlListenerContainer" concurrency=
> "${listener.thread.size}"
>
>                 connection-factory="connectionFactory">
>
>                 <rabbit:listener ref="listener1"  queues="queue1" />
>
>         </rabbit:listener-container>
>
>
>
>
>
>
>
>
>
> *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> 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 ..??
>
>
>
> Thanks
>
> Sagar
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140429/f2ca0c81/attachment.html>


More information about the rabbitmq-discuss mailing list