activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Davies <rajdav...@gmail.com>
Subject Re: ActimeMQ Client's thread management
Date Wed, 13 Jan 2016 11:45:04 GMT

> On 13 Jan 2016, at 03:30, itelleria <telleria@gmail.com> wrote:
> 
> Hi,
> 
> I'm analysing how ActiveMQ client manages the threads to send and receive
> JMS messages and I have some questions that I would like to ask.
> 
> As far as I've understood when I call connectionFactory.createConnection(),
> I get a Connection object which launches a Transport thread in the
> background as well as other threads to monitor inactivity. Monitoring with
> JConsole I can see these ActiveMQ threads running in the client:
> 
> <http://activemq.2283324.n4.nabble.com/file/n4705885/Screen_Shot_2016-01-13_at_08.png>

> 
> Setting the useInactivityMonitor property to false, I can disable the
> inactivity threads. However, apparently I can’t disable Transport thread.
> Therefore, every time a Connection object is created a Transport thread is
> launched?

Yes - this is correct.
> 
> I've seen that Transport threads reads different types of commands from the
> socket connected to the broker (keepalive, wirecommand, messagedispatch,
> etc) and when a MessageDispatch command is received, it executes the
> corresponding MessageListener. So, for asynchronous message delivery I can
> understand why the transport thread is created.
> 
> However, I think there are some cases when this thread is not needed. For
> example, when I send a message I haven't seen that the Transport thread is
> used. So, if I open connection only to send a Message, why the Transport
> thread is created? I guess that the thread, which has invoked the send()
> method, sends the message to the broker without using the transport thread. 

The transport thread is always  required to receive information from the broker by the client
- for example, the first interaction is a negotiation between client and broker about which
version of the WireFormat to use to send messages. Also, some commands sent from the client
need to get a response (e.g. successful login, permission to send messages to a particular
destination etc). When you send a message, the client connection would receive a receipt from
the broker  that the message send was successful. All these interactions require the transport
thread to receive interactions from the broker. Hope that helps!


> 
> Thanks in advance,
> 
> Iñigo
> 
> 
> 
> 
> 
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/ActimeMQ-Client-s-thread-management-tp4705885.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message