• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

newbie question: please help with scja exam question

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 266
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

A1:

Yes JMS supports synchronous messaging.

A JMS client can consume messages either synchronously or asynchronously.

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


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


A2:

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


 
Author
Posts: 3473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to Oracle overview of the JMS API (http://docs.oracle.com/javaee/6/tutorial/doc/bncdr.html),
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?
 
Poop goes in a willow feeder. Wipe with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic