Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

newbie question: please help with scja exam question

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1 Does jms suppor synchronous messaging?
2. if want to write an application for mobile phone, should J2ME only or J2ME &j2se used?

I saw some answers yes/no to both of them. confused.
MyExamCloud Support
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Yes JMS supports synchronous messaging.

A JMS client can consume messages either synchronously or asynchronously.

A client receives a message by invoking the receive() method of the MessageConsumer object.
The application thread blocks until the method returns.

The client registers a MessageListener object with a message consumer.
The application's thread doesn't block.


To write mobile application, we need both J2SE and J2ME APIs.

Posts: 3445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example, In a trading application you may have 2 tasks

1. Verify your trade
2. Create a trade

When you verify a trade, you can submit your trade to a queue, where the trading engine picks up the trade and submit to the market for validation. The client application (e.g. your online trading app) blocks (i.e. synchronous) until a valid response is received. The trade verification needs to be synchronous to communicate any validation errors back to the user.

When you create an order, you could submit it asynchronously (fire and forget). The order status updates will also be received asynchronously once your trade is filled, rejected, etc by the market.
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to Oracle overview of the JMS API (,
the JMS API has three characteristics:
1. Loosely coupling
A component sends a message to a destination, and the recipient can retrieve the message from the destination. However, the sender and the receiver do not have to be available at the same time in order to communicate. In fact, the sender does not need to know anything about the receiver; nor does the receiver need to know anything about the sender. The sender and the receiver need to know only which message format and which destination to use.
2. Communicate asynchronously
A JMS provider can deliver messages to a client as they arrive; a client does not have to request messages in order to receive them.
3. Reliable
The JMS API can ensure that a message is delivered once and only once. Lower levels of reliability are available for applications that can afford to miss messages or to receive duplicate messages.

However, in the lower part of the overview, it introduced JMS within a Java EE context, i.c. how can JMS be used among other Java EE components, such as Application clients, Enterprise JavaBeans (EJB) components, and web components

The JMS API in the Java EE platform has the following features.

Application clients, Enterprise JavaBeans (EJB) components, and web components can send or synchronously receive a JMS message. Application clients can in addition receive JMS messages asynchronously. (Applets, however, are not required to support the JMS API.)

Message-driven beans, which are a kind of enterprise bean, enable the asynchronous consumption of messages. A JMS provider can optionally implement concurrent processing of messages by message-driven beans.

Message send and receive operations can participate in distributed transactions, which allow JMS operations and database accesses to take place within a single transaction.

So, I guess this question depends on the types of components you use: client-side application can receive message asynchronously, while the business component (EJB) and web components (JSP, Servlet) can only receive JMS message synchronously.

Any ideas?
Watchya got in that poodle gun? Anything for me? Or this tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic