Which statement about message-driven beans is true? A. Each message-driven bean instant will be executed by at most one thread at a time. B. When dispatching message to message bean instances, the container must preserve the order in which message arrive. C. If a message-driven bean is associated with JMS queue, each bean instance in the pool will receive each message sent to the queue. D. If a message-driven bean is associated with a JMS durable subscription, with a JMS durable subscription, each bean instance in the pool will receive each message sent to the durable subscription.
I though the answer is A but its C Why?? Can anybody explain for me?
Chapter 15 Message-driven Bean Component Contract 15.8.3 Non-reentrant instances The container must ensure that only one thread can be executing an instance at any time.
15.4.6 Concurrency of message processing 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.
15.4 Protocol between a message-driven bean instance and its container Since all instances of a message-driven bean are equivalent, a client message can be delivered to any available instance
C. false It states any, meaning any one, not all. The big difference between a topic and queue destination is that for a topic a single instance of all bean types registered for a topic receive the message. For a queue only one instance of one of all the registered bean types gets the message; hence the recommendation to have only one MDB type registered for a queue.
D. false (see above 15.4) Again, a single message will only be processed by a single bean instance out of the same pool (unless is re-processed because of a previous exception). As far as "durable topics" go:
15.4 Protocol between a message-driven bean instance and its container Durable topic subscriptions, as well as queues, ensure that messages are not missed even if the EJB server is not running.