• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JMS - (A)synchronous ?!?

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,

In studying for my SCJA a majority of the study guides ive seen state that JMS uses Asynchronous messaging. However i came across the following statement which hints that JMS can do both Asynchronous and Synchronous:

2.3 Message Consumption
Messaging products are inherently asynchronous in that no fundamental timing dependency exists between the production and the consumption of a message. However, the JMS Specification uses this term in a more precise sense. Messages can be consumed in either of two ways:

Synchronously. A subscriber or a receiver explicitly fetches the message from the destination by calling the receive method. The receive method can block until a message arrives or can time out if a message does not arrive within a specified time limit.
Asynchronously. A client can register a message listener with a consumer. A message listener is similar to an event listener. Whenever a message arrives at the destination, the JMS provider delivers the message by calling the listener's onMessage method, which acts on the contents of the message.



am I just interpreting this wrong?
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both above statements are true. However most of times Asynchronous messgaing is used with JMS. Idea about asynchronous can be best understood if transaction scope and boundary.

Event If a receiver is calling receive message method in blocking mode, still it will not be part of sender's transaction.

Regards,
Chetan
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

JMS architecture provides two types of messaging by default. Asynchronous and synchronous method.

There are two destinations which allow you to do both type of messaging. Queue and Topic.
Queue supports asynchronous messaging by Point to point messaging.
Topic supports synchronous messaging by publish/subcriber messaging. So if you want asynchronous messaging in Topic, you can implement MessageListener interface.
 
What does a metric clock look like? I bet it is nothing like this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic