I create a MDB named MyMDB to monitor the JMS queue.
If I send a large of message to that queue, there will be a large of instance of that MDB started.
How can I control only one MyMDB instance starts to handle the message?
My idea is to use only one thread to handle all the message one by one.
Please teach me how can I config it in JBoss7.
You should configure the MDB with the appropriate MaxSession activation configuration property. In this case, it would be "1". For example:
@ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1")
That will ensure there is only 1 JMS session used to consume messages.
Retrieving data ...