Message-driven beans are specially designed to consume JMS messages. It is not advisable to “force” a session bean into this role. They are stateless, server-side, transaction-aware components for processing JMS messages. The EJB container manages transactions, security, resources, concurrency and message acknowledgment for MDBs.
All EJB 3.0 containers must support JMS provider and other providers through JCA (for Connector-based MDBs). In order to send a JMS message, we need a connection to the JMS provider and a destination address for the message. Using a connection factory javax.jms.ConnectionFactory similar to javax.sql.DataSource, you can create a connection to the JMS provider.
