To Paul : Question about Queue In MDB

Which of the following are true statements about an MDB associated with a Queue ? a) Only one instance from the pool of an MDB type can process a message at a given time. b) Multiple instances from the pool of an MDB type can process messages at the same time. c) One instance can handle only one message at a time. d) A message will go to only one bean instance.

ANSWER: B,C,D

Paul,you have given nice explanation for this answer . As a amateur in MDB, i can't get it. Can you please explain this with some example.

Thanks, Jo.

Kay Ra

Ranch Hand

Posts: 80

posted 11 years ago

I think the answer is ACD I don't agree with B. multiple instances of an MBD type should not get the msg. The expannation for this can be illustrated by this example. Let is say we have a msg on receipt on it we need to update a db.So if we have tied it to a queue so only one instance of that msg bean from the pool should get it and act upon it, in this case updating the dtabase. Secondly if you are associating with a topic. then there are multiple msgbeans type listening. So only one instance of each type will act upon the mss eg. 1 instance from MsgBeanType1 its home MSgBeanType1Home and 1 instance from MsgBeanType2 its home being MsgBeanType2Home.

kay SCWCD SCBCD

Roger Chung-Wee

Ranch Hand

Posts: 1683

posted 11 years ago

The EJB container is multithreaded. For pooled beans, each request (or message if we are talking about MDBs) is typically run in a separate thread. Multiple messages will be processed concurrently by pulling the necessary number of beans from the pool. So, B is correct.

Queue means one instance can processes a message at a time. isn't it ?

Thomas

Jesus Angeles

Ranch Hand

Posts: 2068

posted 11 years ago

a) Only one instance from the pool of an MDB type can process a message at a given time. b) Multiple instances from the pool of an MDB type can process messages at the same time.

B.. is okay, because, if 2 messages are received, then 2 mdbs will handle it. Remember that there can be more than one source of message. So for example, at an instant, 2 messages for same MDB type can arrive, and so 2 MDBs will handle it.

A.. is wrong as it is stating a general statement that, "in the entire pool, at any instant, at most, one and only 1 MDB is actively processing something". This is wrong as there can be 2 MDBs from the same pool that are active at a certain moment.

Mahara J

Greenhorn

Posts: 7

posted 11 years ago

Hello Mark , I don't know about Naming policy.This is my real name.But for Last name i added initial.Is it ok? Thanks for the notification. Jo