Set maxsession for MDB through ejb-jar.xml in JBoss

1k Views Asked by At

I want to configure maxsession for MDB So there is a below annotation on the MDB class

@ActivationConfigProperty(propertyName="maxSession",propertyValue="6")

Snippet

@MessageDriven
(activationConfig = 
    {
        @ActivationConfigProperty(propertyName = "acknowledgeMode",
                propertyValue = "Auto-acknowledge"),

        @ActivationConfigProperty(propertyName = "destinationType",
                propertyValue = "javax.jms.Queue"),

        @ActivationConfigProperty(propertyName = "destination",
                propertyValue = "queue/MyQueue"),

        @ActivationConfigProperty(propertyName = "reconnectAttempts",
                propertyValue = "-1"),

        @ActivationConfigProperty(propertyName = "setupAttempts",
                propertyValue = "-1"),                 

        @ActivationConfigProperty(propertyName="maxSession",propertyValue="6")
    },
    mappedName = "MyQueue"
)

and also I have configured the maxsession in ejb-jar.xml

<?xml version='1.0' encoding='UTF-8'?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0">
  <enterprise-beans>

    <message-driven>
      <ejb-name>MDBBean</ejb-name>
      <ejb-class>com.mybean.MDBBean</ejb-class>
    <messaging-type>javax.jms.MessageListener</messaging-type>

      <activation-config>

        <activation-config-property>
          <activation-config-property-name>maxSession</activation-config-property-name>
            <activation-config-property-value>20</activation-config-property-value>
        </activation-config-property>

      <activation-config-property>
            <activation-config-property-name>destination</activation-config-property-name>
            <activation-config-property-value>queue/MyQueue</activation-config-property-value>
        </activation-config-property>

        <activation-config-property>
            <activation-config-property-name>destinationType</activation-config-property-name>
            <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
        </activation-config-property>

      </activation-config>
    </message-driven>

  </enterprise-beans>
</ejb-jar>

AFAIK precedence show be given to ejb-jar.xml and then to annotation.

But when I check "ConsumerCount" through jmx-console it shows 26. That means it adds both the values. And if I remove @ActivationConfigProperty(propertyName="maxSession",propertyValue="6") form cclass file , it shows 35 (i.e. default 15 and then it adds 20 from ejb-jar.xml)

My requirement is , it should pick the value only from ejb-jar.xml. Note: I dont want to remove the annotation from class as the same code is used on the other AS.

1

There are 1 best solutions below

2
Varsha On
  • AFAIK precedence show be given to ejb-jar.xml and then to annotation.

    This is expected behavior. File descriptor value takes precedence over annotation.

  • But when I check "ConsumerCount" through jmx-console it shows 26....

    May I know which JMS broker and container you are using ? I tried with EAP 6.4.x with hornetQ. And I am getting correct consumer count via Jconsole:

enter image description here