4 Replies Latest reply on Apr 20, 2018 5:17 AM by Kavintha Maduranga

    Alternate to MaxMessages in JBoss Eap 7

    Kavintha Maduranga Newbie

      In JBoss 4 following configuration comes as default,

       

      <invoker-proxy-binding>

            <name>message-driven-bean</name>

            <invoker-mbean>default</invoker-mbean>

            <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>

            <proxy-factory-config>

              <JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>

              <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>

              <CreateJBossMQDestination>false</CreateJBossMQDestination>

              <!-- WARN: Don't set this to zero until a bug in the pooled executor is fixed -->

              <MinimumSize>1</MinimumSize>

              <MaximumSize>15</MaximumSize>

              <KeepAliveMillis>30000</KeepAliveMillis>

              <MaxMessages>1</MaxMessages>

              <MDBConfig>

                <ReconnectIntervalSec>10</ReconnectIntervalSec>

                <DLQConfig>

                  <DestinationQueue>queue/DLQ</DestinationQueue>

                  <MaxTimesRedelivered>10</MaxTimesRedelivered>

                  <TimeToLive>0</TimeToLive>

                </DLQConfig>

              </MDBConfig>

            </proxy-factory-config>

          </invoker-proxy-binding>

       

      Due to this configuration, it makes sure that the message order (sequence) is preserved when delivered by MDB.

       

      In EAP Jboss 7 (wildfly 10), do we have an alternative ?

        • 1. Re: Alternate to MaxMessages in JBoss Eap 7
          Miroslav Novak Master

          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
            Kavintha Maduranga Newbie

            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
              Miroslav Novak Master

              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
                Kavintha Maduranga Newbie

                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).