Creating single instance of MDB in glassfish cluster
posted 6 years ago
Could you please help me on the following:-
Multiple instances of the MDBs are getting created in parallel (1 on each instance) even though the max-pool-size is set to 1. Due to this, the messages from a queue are getting consumed in parallel - over the 2 instances of the server.How do i create a single instance of the MDB on glassfish cluster?
Note : We are using EJB3.0 and glassfish 2.1 which does not support @Singleton annotation.
As far as I know you have this problem only with topics. An MDB that listens to a topic and deployed across a cluster would each receive one copy of the message. The container views each subscription from the MDB pool in each cluster as an independent one.
With queues, you shouldnt be having this problem since the message is delivered only to one consumer. So even if the MDBs deployed in the cluster are viewed by the container as independent listeners, only one should get the message. That's what a queue is about.