EJB

EJB Projects

EJB Project 1

EJB Examples

EJB EXAMPLE

Message Driven Beans:
Previous Home Next

The Message Driven beans are distributed components which encapsulate business logic and application. A Message-Driven bean's is an enterprise bean that allowing J2EE applications to process messages asynchronously.

It acts as a JMS message listener, which is similar to an event listener except that it receiving Messages instead of events. The messages may be sent by any J2EE component--an application client, another enterprise bean, or a Web component--or by a JMS application or system that does not use J2EE technology.

Message-driven beans currently process only JMS messages, but in the future they may be used to process other kinds of messages.

Difference between Session beans and Message Driven beans:

  1. Session beans are Synchronous where as message driven beans are Asynchronous.
  2. Session beans are based o RMI where as Message Driven beans are based o Java Messaging Services (JMS).

A Message-Driven Bean's resembling a stateless session bean.

A message-driven bean's instances retaining no data or conversational state for a specific client.

 

All instances of a message-driven bean are equivalent, allowing the EJB container to assign a message to any message-driven bean instance.

The container can pool these instances to allow streams of messages to be processed concurrently.

A Single Message-driven bean can process messages from multiple clients.

The instance variables of the message-driven bean instance can contain some state across the handling of client messages-for example, a JMS API connection, an open database connection, or an object reference to an enterprise bean object.

When a message arrives, the container calls the message-driven bean's on Message method to process the message. The on Message method normally casts the message to one of the five JMS message types and handles it in accordance with the application's business logic. The on Message method may call helper methods, or it may invoke a session or entity bean to process the information in the message or to store it in a database.

Entity Beans:

An Entity beans represent distributed application data as distributed component. In EJB 3.0 a persistent API's in JPA (Java persistent API) was introduce Sun Micro System. which is used by EJB Container for persisting entities. An Entity bean's represented a business object in a persistent storage mechanism.

Some examples of business objects are customers, orders, and products. In the J2EE SDK, The persistent storage mechanism is a relational database. Typically, each entity bean has an underlying table in a relational database, and each instance of the bean corresponds to a row in that table.

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: