[WEBINAR] The New Normal: Dealing with the Reality of an Unsecure World

Message-Driven Bean

Definition - What does Message-Driven Bean mean?

A message-driven bean is a component of a lightweight enterprise application that is used to process messages in asynchronous mode, where the user does not always receive immediate results. Any component can send these messages regardless of whether it uses J2EE technology.

The two distinct features that differentiate message-driven beans from session and entity beans are that message-driven beans cannot be accessed through interfaces and they have only a bean class.

Techopedia explains Message-Driven Bean

Message beans are also noted for the following characteristics:

  • Message-driven beans' instances retain 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.

Message-driven beans are used in asynchronous communication between enterprise application components. A message is processed as follows:

  1. When a new message arrives, the enterprise JavaBeans container calls the message-driven bean’s onMessage method to process the message.
  2. The message is cast as a JMS message, which is handled based on the application’s business logic. Then, if the onMessage method wants to process the message only, it invokes a session bean. If, however, the method wants to store the message in a database, it invokes an entity bean.
  3. The message is then delivered to a message-driven bean so that the above operations become part of a single and complete transaction. A message is sometimes redelivered if there is a rollback in message processing.

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
"Techopedia" on Twitter

Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Free Whitepaper: The Path to Hybrid Cloud
Free Whitepaper: The Path to Hybrid Cloud:
The Path to Hybrid Cloud: Intelligent Bursting To Amazon Web Services & Microsoft Azure
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.