You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "muthukumaran.m@gmail.com" <mu...@gmail.com> on 2013/12/05 16:14:17 UTC

camel-rabbitmq

Hi

I am using Camel 2.12.1 and Rabbitmq 3.2.1

I have defined the following route in my spring config and every time I send
a message to "general.topic" I would expect the message would end up in
"scheduler.queue"

But this doesn't happen it puts the message back to "general.queue" in a
loop. I send only one message to "general.topic" it keeps putting the same
message multiple times in the "general.queue" until I stop the Camel server.

/
	<camelContext xmlns="http://camel.apache.org/schema/spring">
		<route>
			<from
uri="rabbitmq://localhost/general.topic?queue=general.queue&amp;routingKey=general.queue&amp;exchangeType=topic&amp;username=guest&amp;password=guest&amp;autoDelete=false&amp;durable=true"
/>
			<to
uri="rabbitmq://localhost/scheduler.topic?queue=scheduler.queue&amp;routingKey=scheduler.queue&amp;exchangeType=topic&amp;username=guest&amp;password=guest&amp;autoDelete=false&amp;durable=true"
/>
		</route>
	</camelContext>/

If I change the "to" route as "/<to
uri="log:com.mycompany.order?level=INFO"/>/" it logs the message properly in
the log and only once.

Any help or suggestions?.

Thanks.
Muthu






--
View this message in context: http://camel.465427.n5.nabble.com/camel-rabbitmq-tp5744371.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-rabbitmq

Posted by "muthukumaran.m@gmail.com" <mu...@gmail.com>.
Thank you Willem. After upgrading to 2.13.0 and adding BridgeEndpoint=true to
the URI solved this issue.

I ended up using "addresses" as we have 2 RabbitMQ in a cluster.

Thanks,
Muthu



--
View this message in context: http://camel.465427.n5.nabble.com/camel-rabbitmq-routing-issue-tp5744371p5749588.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-rabbitmq

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

If you use camel 2.13.0, you can specify the option of BridgeEndpoint=true, then camel rabbitmq can ignore the message header which are set by camel rabbitmq consumer.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 27, 2014 at 10:50:06 PM, muthukumaran.m@gmail.com (muthukumaran.m@gmail.com) wrote:
> Hi Willem,
>  
> As I removed all of the rabbitmq headers using this pattern "rabbitmq.*",
> This ended up removed "rabbitmq.CONTENT_TYPE" and this is causing trouble
> in converting the message to a Java Object on the consumer.
>  
> Instead of removing all the rabbitmq headers, is there one or two specific
> rabbitmq headers which causes Camel to keep sending same message to the
> general.queue?
>  
> If so I will exclude only that particular header.
>  
> Thanks,
> Muthu
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-rabbitmq-routing-issue-tp5744371p5749441.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Re: camel-rabbitmq

Posted by "muthukumaran.m@gmail.com" <mu...@gmail.com>.
Hi Willem,

As I removed all of the rabbitmq headers using this pattern "rabbitmq.*",
This ended up removed "rabbitmq.CONTENT_TYPE"  and this is causing trouble
in converting the message to a Java Object on the consumer.

Instead of removing all the rabbitmq headers, is there one or two specific
rabbitmq headers which causes Camel to keep sending same message to the 
general.queue? 

If so I will exclude only that particular header.

Thanks,
Muthu



--
View this message in context: http://camel.465427.n5.nabble.com/camel-rabbitmq-routing-issue-tp5744371p5749441.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-rabbitmq

Posted by "muthukumaran.m@gmail.com" <mu...@gmail.com>.
Thanks Willem



--
View this message in context: http://camel.465427.n5.nabble.com/camel-rabbitmq-routing-issue-tp5744371p5744410.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-rabbitmq

Posted by Willem Jiang <wi...@gmail.com>.
In camel we have a rule that message header can override the setting of endpoint.

When consumer receives the message, it puts some headers which key is start with “rabbitmq.”. As the producer always prefer the message header setting over the endpoint setting, the producer sends the message to general.queue. Then the consumer get a new message and route it to the producer. That could explain why you saw the camel keeps sending same message to the  general.queue.

-- 
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
          http://jnn.iteye.com (Chinese)
Twitter: willemjiang 
Weibo: 姜宁willem


On December 6, 2013 at 12:34:57 AM, muthukumaran.m@gmail.com (muthukumaran.m@gmail.com) wrote:
>
>Thanks Willem for the quick response.
>
>Your suggestion resolved my issue. Can you please explain why this issue
>happened and how this fixed it?
>
>Thanks,
>Muthu
>
>
>
>--
>View this message in context: http://camel.465427.n5.nabble.com/camel-rabbitmq-routing-issue-tp5744371p5744374.html
>Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: camel-rabbitmq

Posted by "muthukumaran.m@gmail.com" <mu...@gmail.com>.
Thanks Willem for the quick response.

Your suggestion resolved my issue. Can you please explain why this issue
happened and how this fixed it?

Thanks,
Muthu



--
View this message in context: http://camel.465427.n5.nabble.com/camel-rabbitmq-routing-issue-tp5744371p5744374.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-rabbitmq

Posted by Willem Jiang <wi...@gmail.com>.
You need to remove the message header which is start with “rabbitmq.” just like this
<from xxx/>
<removeHeaders pattern=“rabbitmq.*”/>
<to xxx/> 

-- 
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
          http://jnn.iteye.com (Chinese)
Twitter: willemjiang 
Weibo: 姜宁willem


On December 5, 2013 at 11:19:29 PM, muthukumaran.m@gmail.com (muthukumaran.m@gmail.com) wrote:
>
>Hi
>
>I am using Camel 2.12.1 and Rabbitmq 3.2.1
>
>I have defined the following route in my spring config and every time I send
>a message to "general.topic" I would expect the message would end up in
>"scheduler.queue"
>
>But this doesn't happen it puts the message back to "general.queue" in a
>loop. I send only one message to "general.topic" it keeps putting the same
>message multiple times in the "general.queue" until I stop the Camel server.
>
>/
>
>
>>uri="rabbitmq://localhost/general.topic?queue=general.queue&routingKey=general.queue&exchangeType=topic&username=guest&password=guest&autoDelete=false&durable=true"
>/>
>>uri="rabbitmq://localhost/scheduler.topic?queue=scheduler.queue&routingKey=scheduler.queue&exchangeType=topic&username=guest&password=guest&autoDelete=false&durable=true"
>/>
>
>/
>
>If I change the "to" route as "/>uri="log:com.mycompany.order?level=INFO"/>/" it logs the message properly in
>the log and only once.
>
>Any help or suggestions?.
>
>Thanks.
>Muthu
>
>
>
>
>
>
>--
>View this message in context: http://camel.465427.n5.nabble.com/camel-rabbitmq-tp5744371.html
>Sent from the Camel - Users mailing list archive at Nabble.com.
>