On 2/21/19 10:24 PM, Justin Bertram wrote:
I looked at the code for the javax.jms.Connection implementation in
ActiveMQ 5 and it wasn't clear to me what would have been blocking in the
call to start(). Artemis supports the OpenWire protocol so you can still
use the 5.x client. If you use the 5.x client with Artemis does it block?
I'd be curious to see a thread dump from the client when it's blocking as
you describe.

The start method doesn't block but the ActiveMQ 5.x client lot many other JMS clients I'm aware of does keep a single non-daemon thread running at all times or order to do what the user is asking.  Qpid JMS does that same but is configurable to not do as, and I think I recall there being a configuration option in 5.x as well.  So what is happening is that the JVM isn't shutting down because of this, the receiver will keep on getting messages until it closes the connection.



Justin

On Thu, Feb 21, 2019 at 8:37 PM Riyafa Abdul Hameed <riyafa...@cse.mrt.ac.lk>
wrote:

Hi,

I tried the same example (after changing the contextfactory) with ActiveMQ
(version 5.15.8) and the main program does not exit. That is the reason I
expected the same behavior from ActiveMQ Artemis. If that is not defined in
the JMS spec I will follow other ways you have suggested to prevent the
program from exiting.

Thank you for the clarification.

Regards,
Riyafa

On Thu, 21 Feb 2019 at 21:42, michael.andre.pearce
<michael.andre.pea...@me.com.invalid> wrote:

You could use a countdown latch that then when you wish to shutdown you
simply from another thread countdown.Sent from my Samsung Galaxy
smartphone.
-------- Original message --------From: Riyafa Abdul Hameed <
riy...@apache.org> Date: 21/02/2019  14:06  (GMT+00:00) To:
users@activemq.apache.org Subject: JMS Asynchronous Receiver for
ActiveMQ
Artemis Hi,I have the following asynchronous receiver for ActiveMQ
Artemis:
https://gist.github.com/riyafa/7b0e5814286c60edb157f9a83fb64765Here what
I would expect when I call queueConn.start(); is that I want thethread to
wait to  receive messages. I mean I don't want the main to exitcausing
the
program to shutdown. This is the expected behavior in JMS if Iam not
mistaken because I noticed this behavior in other brokers.But with JMS in
ActiveMQ Artemis I don't get the same behavior. The mainprogram exits
even
though I am calling  connection.start(). Is there anyother way that I can
use the MessageListener and not have the program exitapart from using
Thread.sleep?I am using artemis client 2.6.3.Thanks,Riyafa


--
Riyafa Abdul Hameed
Graduate, University of Moratuwa

Email: riyafa...@cse.mrt.ac.lk
Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
<http://facebook.com/riyafa.ahf>  <http://lk.linkedin.com/in/riyafa>
<http://twitter.com/Riyafa1>


--
Tim Bish

Reply via email to