You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kiranreddykasa <ki...@fss.co.in> on 2013/08/06 09:29:44 UTC

camel - Activemq strange behaviour

Hi 

I'm trying to implement camel-activemq.

Here is the route :

	from("netty:tcp://0.0.0.0:7000?textline=true")
				.bean(MainProcessor.class)
			
.to("activemq:CAMEL_ONE_QUEUE?testConnectionOnStartup=true&replyTo=CAMEL_ONE_QUEUE_REP&replyToType=Exclusive&concurrentConsumers=100&maxConcurrentConsumers=200")
				.choice()
					.when(body().not(body().endsWith('F')))
					.otherwise().stop()
				    .end()
			
.to("activemq:CAMEL_TWO_QUEUE?testConnectionOnStartup=true&replyTo=CAMEL_TWO_QUEUE_REP&replyToType=Exclusive&concurrentConsumers=100&maxConcurrentConsumers=200&destination.consumer.prefetchSize=1")
				.choice()
					.when(body().not(body().endsWith('F')))
					.otherwise().stop()
					.end()
			
.to("activemq:CAMEL_THREE_QUEUE?testConnectionOnStartup=true&replyTo=CAMEL_THREE_QUEUE_REP&replyToType=Exclusive&concurrentConsumers=100&maxConcurrentConsumers=200&destination.consumer.prefetchSize=1");


I have deployed this same route in two servers .
I have installed activemq in single server (first server).

And upfront I have load balancer ,sending messages in roundrobin.

Whenever I'm sending messages to server 1 , messages are processing
properly, but when I'm sending messages to second server no one is picking
up that messages from first queue and default timeout is happening.

Second server is also using the same activemq which is installed in the
first server.

camel version : 2.10.5
activemq : 5.8



-----
Regards

kiran Reddy
--
View this message in context: http://camel.465427.n5.nabble.com/camel-Activemq-strange-behaviour-tp5736812.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel - Activemq strange behaviour

Posted by kiranreddykasa <ki...@fss.co.in>.
Thanks

Is this the way to set prefetch limit destination.consumer.prefetchSize=1  ?

And it has to be set on producer only right ?




-----
Regards

kiran Reddy
--
View this message in context: http://camel.465427.n5.nabble.com/camel-Activemq-strange-behaviour-tp5736812p5736820.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel - Activemq strange behaviour

Posted by kiranreddykasa <ki...@fss.co.in>.
hi 

I tried setting prefetch limit to 1 , but still of no use.

And according to link you have given , at least the first server's 
consumers should get the message right ?? 

No one is picking up the messages and timeout is happening. 



-----
Regards

kiran Reddy
--
View this message in context: http://camel.465427.n5.nabble.com/camel-Activemq-strange-behaviour-tp5736812p5736822.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel - Activemq strange behaviour

Posted by Christian Posta <ch...@gmail.com>.
On Wed, Aug 7, 2013 at 3:08 AM, kiranreddykasa <ki...@fss.co.in>wrote:

> Hi
>
> Thanks a lot.
>
> So we should have unique queue names in cluster environment, if we are
> using
> replyToType as exclusive
>

This is correct. The camel docs explicitly say not to use Exclusive in your
type of deployment:

"A shared queue can be used in a clustered environment with multiple nodes
running this Camel application at the same time"

  "When using exclusive reply queues, then JMS Message selectors are
*not*in use, and therefore other applications must not use this queue
as well.
An exclusive queue *cannot* be used in a clustered environment with
multiple nodes running this Camel application at the same time"


>
> or temporary queues can be used.
>
>
>
> -----
> Regards
>
> kiran Reddy
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/camel-Activemq-strange-behaviour-tp5736812p5736908.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: camel - Activemq strange behaviour

Posted by kiranreddykasa <ki...@fss.co.in>.
Hi 

Thanks a lot.

So we should have unique queue names in cluster environment, if we are using
replyToType as exclusive

or temporary queues can be used.



-----
Regards

kiran Reddy
--
View this message in context: http://camel.465427.n5.nabble.com/camel-Activemq-strange-behaviour-tp5736812p5736908.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel - Activemq strange behaviour

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Read the docs about jms request/reply

On Tue, Aug 6, 2013 at 2:28 PM, kiranreddykasa <ki...@fss.co.in> wrote:
> Hi
>
> I think I figure out the problem.
>
> Here is the scenario,
>
> 1 Start producers and consumers in server 1.
>
> 2 Send requests to first server, everything will be processed.
>
> 3 Start producers and consumers in server 2.
>
> 4 Send requests to first server, everything will be processed.
> But if we send requests to second server,the message is processed at
> CAMEL_ONE_QUEUE and reply is kept on CAMEL_ONE_QUEUE_REP
>
> As first server's consumers are also listening to same reply queue, it's
> processed by that consumers and it is ignoring with invalid correlation id.
>
> Here is the log message :
> WARN 06 Aug 2013 17:47:58,428
> org.apache.camel.component.jms.reply.PersistentQueueReplyManager - Reply
> received for unknown correlationID
> [Camel-ID-fsschnd12298-2458-1375791411312-0-3]. The message will be ignored:
> ActiveMQTextMessage {commandId = 167006, responseRequired = false, messageId
> = ID:FSSCHN61-39193-1375789791590-1:3:93:1:1, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:FSSCHN61-39193-1375789791590-1:3:93:1, destination =
> queue://CAMEL_ONE_QUEUE_REP, transactionId = null, expiration = 0, timestamp
> = 1375791482060, arrival = 0, brokerInTime = 1375791482061, brokerOutTime =
> 1375791482061, correlationId = Camel-ID-fsschnd12298-2458-1375791411312-0-3,
> replyTo = queue://CAMEL_ONE_QUEUE_REP, persistent = true, type = null,
> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
> compressed = false, userID = null, content = null, marshalledProperties =
> org.apache.activemq.util.ByteSequence@783d783d, dataStructure = null,
> redeliveryCounter = 0, size = 0, properties = {CamelJmsDeliveryMode=2,
> breadcrumbId=ID-fsschnd12298-2458-1375791411312-0-1}, readOnlyProperties =
> true, readOnlyBody = true, droppable = false, text =
> C1123454712345678901210000000201234}
>
>
> Do we have to set prefetch for reply queue also ?
> If yes how can we set ?
>
>
>
> -----
> Regards
>
> kiran Reddy
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-Activemq-strange-behaviour-tp5736812p5736846.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: camel - Activemq strange behaviour

Posted by kiranreddykasa <ki...@fss.co.in>.
Hi 

I think I figure out the problem.

Here is the scenario,

1 Start producers and consumers in server 1.

2 Send requests to first server, everything will be processed.

3 Start producers and consumers in server 2.

4 Send requests to first server, everything will be processed. 
But if we send requests to second server,the message is processed at
CAMEL_ONE_QUEUE and reply is kept on CAMEL_ONE_QUEUE_REP

As first server's consumers are also listening to same reply queue, it's
processed by that consumers and it is ignoring with invalid correlation id.

Here is the log message : 
WARN 06 Aug 2013 17:47:58,428
org.apache.camel.component.jms.reply.PersistentQueueReplyManager - Reply
received for unknown correlationID
[Camel-ID-fsschnd12298-2458-1375791411312-0-3]. The message will be ignored:
ActiveMQTextMessage {commandId = 167006, responseRequired = false, messageId
= ID:FSSCHN61-39193-1375789791590-1:3:93:1:1, originalDestination = null,
originalTransactionId = null, producerId =
ID:FSSCHN61-39193-1375789791590-1:3:93:1, destination =
queue://CAMEL_ONE_QUEUE_REP, transactionId = null, expiration = 0, timestamp
= 1375791482060, arrival = 0, brokerInTime = 1375791482061, brokerOutTime =
1375791482061, correlationId = Camel-ID-fsschnd12298-2458-1375791411312-0-3,
replyTo = queue://CAMEL_ONE_QUEUE_REP, persistent = true, type = null,
priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
compressed = false, userID = null, content = null, marshalledProperties =
org.apache.activemq.util.ByteSequence@783d783d, dataStructure = null,
redeliveryCounter = 0, size = 0, properties = {CamelJmsDeliveryMode=2,
breadcrumbId=ID-fsschnd12298-2458-1375791411312-0-1}, readOnlyProperties =
true, readOnlyBody = true, droppable = false, text =
C1123454712345678901210000000201234}


Do we have to set prefetch for reply queue also ?
If yes how can we set ?



-----
Regards

kiran Reddy
--
View this message in context: http://camel.465427.n5.nabble.com/camel-Activemq-strange-behaviour-tp5736812p5736846.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel - Activemq strange behaviour

Posted by Claus Ibsen <cl...@gmail.com>.
ActiveMQ clients have a prefetch buffer. Try setting the prefetch
buffer to 0 or 1.

You can find details about that on the AMQ site.
http://activemq.apache.org/what-is-the-prefetch-limit-for.html
http://activemq.apache.org/i-do-not-receive-messages-in-my-second-consumer.html

A tip is to type prefetch in the search box on the AMQ front page
website and check the links.


On Tue, Aug 6, 2013 at 9:29 AM, kiranreddykasa <ki...@fss.co.in> wrote:
> Hi
>
> I'm trying to implement camel-activemq.
>
> Here is the route :
>
>         from("netty:tcp://0.0.0.0:7000?textline=true")
>                                 .bean(MainProcessor.class)
>
> .to("activemq:CAMEL_ONE_QUEUE?testConnectionOnStartup=true&replyTo=CAMEL_ONE_QUEUE_REP&replyToType=Exclusive&concurrentConsumers=100&maxConcurrentConsumers=200")
>                                 .choice()
>                                         .when(body().not(body().endsWith('F')))
>                                         .otherwise().stop()
>                                     .end()
>
> .to("activemq:CAMEL_TWO_QUEUE?testConnectionOnStartup=true&replyTo=CAMEL_TWO_QUEUE_REP&replyToType=Exclusive&concurrentConsumers=100&maxConcurrentConsumers=200&destination.consumer.prefetchSize=1")
>                                 .choice()
>                                         .when(body().not(body().endsWith('F')))
>                                         .otherwise().stop()
>                                         .end()
>
> .to("activemq:CAMEL_THREE_QUEUE?testConnectionOnStartup=true&replyTo=CAMEL_THREE_QUEUE_REP&replyToType=Exclusive&concurrentConsumers=100&maxConcurrentConsumers=200&destination.consumer.prefetchSize=1");
>
>
> I have deployed this same route in two servers .
> I have installed activemq in single server (first server).
>
> And upfront I have load balancer ,sending messages in roundrobin.
>
> Whenever I'm sending messages to server 1 , messages are processing
> properly, but when I'm sending messages to second server no one is picking
> up that messages from first queue and default timeout is happening.
>
> Second server is also using the same activemq which is installed in the
> first server.
>
> camel version : 2.10.5
> activemq : 5.8
>
>
>
> -----
> Regards
>
> kiran Reddy
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-Activemq-strange-behaviour-tp5736812.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen