Describe the use and behavior of a JMS message driven bean, including concurrency of message processing, message redelivery, and message acknowledgement.

  • [EJB_3.0_CORE] 5.4.10; 5.4.11; 5.4.14; 13.6.3;;

Serializing Message-Driven Bean Methods

The container serializes calls to each message-driven bean instance. Most containers will support many instances of a message-driven bean executing concurrently; however, each instance sees only a serialized sequence of method calls. Therefore, a message-driven bean DOES NOT have to be coded as reentrant.

The container MUST serialize all the container-invoked callbacks (e.g., lifecycle callback interceptor methods and timeout callback methods), and it must serialize these callbacks with the message listener method calls.

Concurrency of Message Processing

A container allows MANY instances of a message-driven bean class to be executing concurrently, thus allowing for the concurrent processing of a stream of messages. No guarantees are made as to the exact order in which messages are delivered to the instances of the message-driven bean class, although the container should attempt to deliver messages in order when it does not impair the concurrency of message processing. Message-driven beans should therefore be prepared to handle messages that are out of sequence: for example, the message to cancel a reservation may be delivered before the message to make the reservation.

Message Acknowledgment for JMS Message-Driven Beans

JMS message-driven beans should NOT attempt to use the JMS API for message acknowledgment. Message acknowledgment is automatically handled by the CONTAINER. If the message-driven bean uses container-managed transaction (CMT) demarcation, message acknowledgment is handled automatically as a part of the transaction commit. If bean-managed transaction (BMT) demarcation is used, the message receipt cannot be part of the bean-managed transaction, and, in this case, the receipt is acknowledged by the container. If BEAN-MANAGED TRANSACTION demarcation is used, the Bean Provider CAN indicate whether JMS AUTO_ACKNOWLEDGE semantics or DUPS_OK_ACKNOWLEDGE semantics should apply by using the activationConfig element of the MessageDriven annotation or by using the activation-config-property deployment descriptor element. The property name used to specify the acknowledgment mode is acknowledgeMode. If the acknowledgeMode property is NOT specified, JMS AUTO_ACKNOWLEDGE semantics are ASSUMED. The value of the acknowledgeMode property MUST be either Auto-acknowledge or Dups-ok-acknowledge for a JMS message-driven bean.

Professional hosting     Belorussian informational portal         Free SCWCD 1.4 Study Guide     Free SCDJWS 1.4 Study Guide     SCDJWS 1.4 Quiz     Free IBM Certified Associate Developer Study Guide     IBM Test 000-287. Enterprise Application Development with IBM WebSphere Studio, V5.0 Study Guide     Free Mock Exam Engine