Only ONE bean per pool gets a copy of a topic message

If you have, say, the WelcomeBean subscribed to the NewCustomer topic, when a new message is published to that topic, the Container will choose only one bean from the WelcomeBean pool to get the message. Remember, the Container keeps a separate pool of beans for each home (and every deployed bean type gets its own home). The Container doesn’t put all message-driven beans into one pool, even if they’re subscribed to the same topics.

But if there are multiple bean types subscribed to that topic, one bean from each of those pools will also get the message. In this picture, both the WelcomeBean and the NewSalesBean are subscribers to the NewCustomer topic, so the Container selects one bean from each pool to get the message.

Note

Only one bean per subscriber pool will get the message. NOT every bean in the pool!

image with no caption

Get Head First EJB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.