• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 397
  • Last Modified:

JMS: Truely asynchronize?

I quoted following text from website:

My questions is how to get truely asynchronize call? When receiving message, JMS seems to use one thread to keep asking whether message is arrived or not?

18.4.2. Synchronous Receiving

While JMS is typically associated with asynchronous processing, it is possible to consume messages synchronously. The overloaded receive methods provide this functionality. During a synchronous receive the calling thread blocks until a message becomes available. This can be a dangerous operation since the calling thread can potentially be blocked indefinitely. The property receiveTimeout specifies how long the receiver should wait before giving up waiting for a message.
6 Solutions
JMS can be completely asynchronous. The 'other end' doesn't even need to be connected all the time and you can't get more asynchronous than that
>  JMS seems to use one thread to keep asking whether message is arrived or not?

That doesn't make it synchronous, that technique wcould still process message asynchronously.
And how it handles receiving the message is dependent on the server implementation, not JMS itself.
Not disagreeing with the 2 statements above, but I think both are not addressing your specific question.

JMS is just another messaging service. In virtual all messaging services (from low level sockets to MQ Series) the differentiation from syncrhonous to asynchronous messaging model has to do with:

1) polling/looping/explicitly checking for messages (syncrhonous)
2) registering a listener and a callback mechanism (asynchonous)

We are discussing asynchronous in terms of receiving the message, not handling the message. Either model can asynchronously _handle_ the method, but that is outside the JMS model at that point.

The point to be clear on is the URL you refer to is a classic synchronous polling method, not a callback method.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

JianJunShenAuthor Commented:
Refer to mrjoltcola message, where is tutorial for 2) registering a listener and a callback mechanism (asynchonous)?
I believe the book "Spring into Action" also has a good section on it, but my book is at the office so I cannot verify. I recommend buying the book if you are using Spring in your projects. It covers many useful things.

> http://static.springframework.org/spring/docs/1.2.x/reference/jms.html#d0e1324

Thats a bit out of date btw
Do you specifically need to use 1.2?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now