camel - Activemq strange behaviour

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

camel - Activemq strange behaviour

kiranreddykasa
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
Reply | Threaded
Open this post in threaded view
|

Re: camel - Activemq strange behaviour

Claus Ibsen-2
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 <[hidden email]> 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: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: camel - Activemq strange behaviour

kiranreddykasa
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
Reply | Threaded
Open this post in threaded view
|

Re: camel - Activemq strange behaviour

kiranreddykasa
In reply to this post by Claus Ibsen-2
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
Reply | Threaded
Open this post in threaded view
|

Re: camel - Activemq strange behaviour

kiranreddykasa
In reply to this post by Claus Ibsen-2
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
Reply | Threaded
Open this post in threaded view
|

Re: camel - Activemq strange behaviour

Claus Ibsen-2
Hi

Read the docs about jms request/reply

On Tue, Aug 6, 2013 at 2:28 PM, kiranreddykasa <[hidden email]> 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: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: camel - Activemq strange behaviour

kiranreddykasa
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
Reply | Threaded
Open this post in threaded view
|

Re: camel - Activemq strange behaviour

ceposta
On Wed, Aug 7, 2013 at 3:08 AM, kiranreddykasa <[hidden email]>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