You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by krishy <ca...@gmail.com> on 2011/12/22 22:04:38 UTC

ActiveMQ messages not being received

We use Camel to send and receive messages from ActiveMQ and observe that
seemingly randomly our integration tests fail. I have not been able to
observe any pattern and even with Camel turned up to TRACE level, see no
exceptions/errors in the logs.

Most test cases are a variation of the following:

create route from jms topic (with no selector) -> bean
create route from jms topic (with a selector) -> bean
send a message (that would have been satisfied by the selector)
sleep 5 seconds
assert the beans received the message.

What we observe is that the listeners are registered alright:

[                          main] JmsConsumer                    DEBUG
Starting consumer: Consumer[activemq://topic:Assets?selector=]

and

[                          main] JmsConsumer                    DEBUG
Starting consumer:
Consumer[activemq://topic:Assets?selector=eventType+IN+%28%27Create%27%29]


The message is sent alright:

[l) thread #18 - seda://enqueue] Configuration$CamelJmsTemplate TRACE Sent
JMS message to: topic://Assets with message: ActiveMQBytesMessage {commandId
= 0, responseRequired = false, messageId =
ID:hudson-56463-1324586663618-0:4:3:1:1, originalDestination = null,
originalTransactionId = null, producerId = null, destination =
topic://Assets, transactionId = null, expiration = 0, timestamp =
1324586696947, arrival = 0, brokerInTime = 0, brokerOutTime = 0,
correlationId = null, replyTo = null, persistent = false, type = null,
priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
compressed = false, userID = null, content =
org.apache.activemq.util.ByteSequence@1da4d2c0, marshalledProperties = null,
dataStructure = null, redeliveryCounter = 0, size = 0, properties =
{source=WEB, eventType=Create}, readOnlyProperties = false, readOnlyBody =
false, droppable = false} ActiveMQBytesMessage{ bytesOut = null, dataOut =
null, dataIn = null }

but it is not received by the listeners. The fact that the same tests pass
once in a while for the same set of messages is very confusing. We have also
tried adding a sleep between the time the message is done and the
assertation is done to rule out any race conditions but still no luck; the
random failures continue.

We run the ActiveMQ instance for the tests using the activemq-tooling maven
plugin.

mvn activemq:run test

Any clues/pointers greatly appreciated

PS: Apologies if this does not appear to be Camel issue and but an ActiveMQ
issue! 



--
View this message in context: http://camel.465427.n5.nabble.com/ActiveMQ-messages-not-being-received-tp5095635p5095635.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ActiveMQ messages not being received

Posted by krishy <ca...@gmail.com>.
Claus Ibsen-2 wrote
> 
> For topics you need durable subscribers to ensure they receive the
> message.
> As the message will be discarded if sent to a topic with no active
> subscribers.
> Durable subscribers ensures the message will be stored, and send when
> the subscriber becomes active.
> 

As the log message seemed to indicate the subscribers were active and ready
before the message was sent. Is my reading of the logs incorrect?

--
View this message in context: http://camel.465427.n5.nabble.com/ActiveMQ-messages-not-being-received-tp5095635p5104150.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ActiveMQ messages not being received

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

For topics you need durable subscribers to ensure they receive the message.
As the message will be discarded if sent to a topic with no active subscribers.
Durable subscribers ensures the message will be stored, and send when
the subscriber becomes active.


On Thu, Dec 22, 2011 at 10:04 PM, krishy <ca...@gmail.com> wrote:
> We use Camel to send and receive messages from ActiveMQ and observe that
> seemingly randomly our integration tests fail. I have not been able to
> observe any pattern and even with Camel turned up to TRACE level, see no
> exceptions/errors in the logs.
>
> Most test cases are a variation of the following:
>
> create route from jms topic (with no selector) -> bean
> create route from jms topic (with a selector) -> bean
> send a message (that would have been satisfied by the selector)
> sleep 5 seconds
> assert the beans received the message.
>
> What we observe is that the listeners are registered alright:
>
> [                          main] JmsConsumer                    DEBUG
> Starting consumer: Consumer[activemq://topic:Assets?selector=]
>
> and
>
> [                          main] JmsConsumer                    DEBUG
> Starting consumer:
> Consumer[activemq://topic:Assets?selector=eventType+IN+%28%27Create%27%29]
>
>
> The message is sent alright:
>
> [l) thread #18 - seda://enqueue] Configuration$CamelJmsTemplate TRACE Sent
> JMS message to: topic://Assets with message: ActiveMQBytesMessage {commandId
> = 0, responseRequired = false, messageId =
> ID:hudson-56463-1324586663618-0:4:3:1:1, originalDestination = null,
> originalTransactionId = null, producerId = null, destination =
> topic://Assets, transactionId = null, expiration = 0, timestamp =
> 1324586696947, arrival = 0, brokerInTime = 0, brokerOutTime = 0,
> correlationId = null, replyTo = null, persistent = false, type = null,
> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
> compressed = false, userID = null, content =
> org.apache.activemq.util.ByteSequence@1da4d2c0, marshalledProperties = null,
> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> {source=WEB, eventType=Create}, readOnlyProperties = false, readOnlyBody =
> false, droppable = false} ActiveMQBytesMessage{ bytesOut = null, dataOut =
> null, dataIn = null }
>
> but it is not received by the listeners. The fact that the same tests pass
> once in a while for the same set of messages is very confusing. We have also
> tried adding a sleep between the time the message is done and the
> assertation is done to rule out any race conditions but still no luck; the
> random failures continue.
>
> We run the ActiveMQ instance for the tests using the activemq-tooling maven
> plugin.
>
> mvn activemq:run test
>
> Any clues/pointers greatly appreciated
>
> PS: Apologies if this does not appear to be Camel issue and but an ActiveMQ
> issue!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ActiveMQ-messages-not-being-received-tp5095635p5095635.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/