This topic describes things to consider when designing an enterprise application to use message-driven beans.
Why and when to perform this task
The considerations in this topic are based on a generic enterprise application that uses one message-driven bean to retrieve messages from a JMS queue destination and passes the messages on to another enterprise bean that implements the business logic.
To design an enterprise application to use message-driven beans, complete the following steps:
Steps for this task
JMS resource type | Properties |
---|---|
Queue connection factory | Name: SamplePtoPQueueConnectionFactory JNDI Name: Sample/JMS/QCF |
Queue destination | Name: Q1 JNDI Name: Sample/JMS/Q1 |
Listener port (for the destination) | Name: SamplePtoPListenerPort Connection Factory JNDI Name: Sample/JMS/QCF Destination JNDI Name: Sample/JMS/Q1 Maximum Sessions: 5 Maximum Retries: 10 Maximum Messages: 1 |
Message-driven bean (deployment properties) | Name: JMSppSampleMDBBean Transaction type: Container Destination type: Queue Listener port name: SamplePtoPListenerPort |
Business logic bean | Name: MyLogicBean |
Ensure that you use consistent values where needed; for example, the JNDI names for the connection factory and destination must be the same for both those resources and the equivalent properties of the listener port.
Messages arriving at a destination being processed by a listener have no client credentials associated with them; the messages are anonymous. Security depends on the role specified by the RunAs Identity for the message-driven bean as an EJB component. For more information about EJB security, see Enterprise bean component security.
Note: Message-driven beans cannot use the direct listener port for Publish/Subscribe support. Therefore, any topic connection factory configured with Portset to Direct cannot be used with message-driven beans.
A non-durable subscriber can only be used in the same transactional context (for example, a global transaction or an unspecified transaction context) that existed when the subscriber was created. For more information about this context restriction, see The effect of transaction context on non-durable subscribers.
For more information about the configuration considerations, see Configuring message listener resources for message-driven beans.