git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Receiving messages via receiveNoWait()


Hello all,

we are using ActiveMQ 5.15.6 in our application. The application is built on top of OSGi and uses ActiveMQ as an embedded Broker within the container. The container establishes a single intraVM connection to the broker, messages are being sent and consumed in several sessions reusing the same connection. External clients may establish connections via SSL to send or consume messages.

Essentially, each of our containers serves as a self-contained message router taking dispatching
dispatching messages from one technology to another.

The core of our ActiveMQ listener is implemented as an Akka Stream Source, which tries to consume
messages regularly using a receiveNoWait.

I have now seen in our integration tests, that in ~one of 100 runs the integration test fails. According to the log files the consumer polls for messages, but none are delivered even if a message is available in
the destination.

Is receiveNoWait() the proper mechanism to consume messages in a polling fashion ? Should I use receive(timeout) instead ? If so, what would be a reasonable value for the timeout ?

In this particular use case we do not want to use an event driven consumer as the stream source has to wait until the message is processed, so that we can explicitly acknowledge the received message
using msg.acknowledge().


Any hints how I could debug this issue further would be greatly appreciated.

Best regards

Andreas