activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Bertram <>
Subject Re: JMS Asynchronous Receiver for ActiveMQ Artemis
Date Thu, 21 Feb 2019 14:50:04 GMT
I've never seen or heard of javax.jms.Connection.start() blocking in that
respect, and the JMS specification doesn't describe the behavior you
expect. I think such behavior would be problematic in many use-cases (e.g.
when you don't want to block). The whole point behind using a
MessageListener is *not* to block.

There are lots of different ways to prevent your main() from exiting. Here
are a few off the top of my head:

  1) Wait for a specific bit of user input from the console.
  2) Poll for a status file.
  3) Use one of the many helpful objects in java.util.concurrent (e.g.
CountDownLatch, Semaphore, one of the lock implementations in the locks


On Thu, Feb 21, 2019 at 8:06 AM Riyafa Abdul Hameed <>

> Hi,
> I have the following asynchronous receiver for ActiveMQ Artemis:
> Here what I would expect when I call queueConn.start(); is that I want the
> thread to wait to  receive messages. I mean I don't want the main to exit
> causing the program to shutdown. This is the expected behavior in JMS if I
> am not mistaken because I noticed this behavior in other brokers.
> But with JMS in ActiveMQ Artemis I don't get the same behavior. The main
> program exits even though I am calling  connection.start(). Is there any
> other way that I can use the MessageListener and not have the program exit
> apart from using Thread.sleep?
> I am using artemis client 2.6.3.
> Thanks,
> Riyafa

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message