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.
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
onMessagemethod of ajavax.jms.MessageListenerwill be invoked in another thread in order to receive messages asynchronously as defined in the JMS specification.