Is MessageListener object in JMS thread?

903 Views Asked by At

I'm writting a Java application for messaging between two or more clients. I'm using JMS (Java Messaging Service). For receiving message I wrote a MessageListener object that implements the javax.jms.MessageListener with onMessage method.

I'm wondering if the MessageListener object is some kind of background thread? I think it is a thread, because MessageListener receives and processes messages while my application is working on other things.

1

There are 1 best solutions below

0
On

Every JMS provider implements their own JMS client so it's impossible to answer this question with 100% certainty without knowing what JMS client you're using, but in general the onMessage method of a javax.jms.MessageListener will be invoked in another thread in order to receive messages asynchronously as defined in the JMS specification.