Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MDB Question

 
pramoth suwanpech
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Answer: C


I though the answer is A but its C
Why??
Can anybody explain for me?
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Enterprise JavaBeans Specification, Version 2.0

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.

A. true


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.

B. false


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.
 
pramoth suwanpech
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic