-
1. Re: Alternate to MaxMessages in JBoss Eap 7
mnovak Apr 10, 2018 8:31 AM (in response to kavinthamaduranga)One way to do it is to add maxSession activation config property to your MDB like:
@MessageDriven(name = "SimpleMdb", activationConfig = {
...
@ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1"),
...
})
public class SimpleMdb implements MessageListener {
...
It can be added also to deployment descriptor of the MDB. However I'm not sure if it's possible to do so in server configuration like in JBoss 4.
Edit: It is possible in the config as well. Connect to server in CLI and run following commands:
sh jboss-cli.sh
connect <your-server>:9990
/subsystem=ejb3/strict-max-bean-instance-pool=mdb-strict-max-pool:undefine-attribute(name=derive-size)
/subsystem=ejb3/strict-max-bean-instance-pool=mdb-strict-max-pool:write-attribute(name=max-pool-size,value=1)
reload
Note however that will affect all deployed MDBs in your server.
-
2. Re: Alternate to MaxMessages in JBoss Eap 7
kavinthamaduranga Apr 17, 2018 12:55 PM (in response to mnovak)Hi Miroslav, thanks for the answer and couldn't reply earlier due to holidays :-) .I tried maxSessions attribute but didn't work as expected and in some places it was mentioned as "maxSssions" instead "maxSession". So i'm confused what is the right attribute name and where can i find the attribute list.
Secondly setting the max-pool-size to 1 is not an option that I have.
-
3. Re: Alternate to MaxMessages in JBoss Eap 7
mnovak Apr 18, 2018 3:30 AM (in response to kavinthamaduranga)For sure it's maxSession. I tried to configure MDB with maxSessions and it did not do the job.
Also I tried to deploy MDB with:
@ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1")
and then send 1000 messages and all messages were consumed in correct order by MDB. I tried it a few times and never got message out of order. I suspect that you might have something different.
-
4. Re: Alternate to MaxMessages in JBoss Eap 7
kavinthamaduranga Apr 20, 2018 5:17 AM (in response to mnovak)I tried with "maxSession" attribute and it worked as expected. Thanks for the solution And what is your opinion about code level synchronization in MDB s (If we are going to handle the message order in manual way).
-
5. Re: Alternate to MaxMessages in JBoss Eap 7
mnovak Apr 23, 2018 4:34 AM (in response to kavinthamaduranga)General rule of thumb is not to synchronize work between calls of EJB methods (MDB is just stateless session bean with one required method onMessage() which is called by application server). So I would recommend to avoid it. Message must be still processed in correct order (serially) so I guess there will be no or little performance gain.
It depends on your use case. If one queue is used for more "message types" where each type must be processed per given order then you might use message filters. You would have more MDBs where each would be consuming given messages (based on filter) serially.