ConfigJBossMDB

    MDB Configuration using the old invoker proxy binding (JMSContainerInvoker)

     

    Complete and up-to-date details can be found in the dtd

     

    $JBOSS_HOME/docs/dtd/jboss_x_y.dtd

     

    Delivery

     

    The delivery to the mdb is handled by the invoker-proxy-binding. Here we consider the JMSContainerInvoker.

     

    NOTE: A container configuration can have more than one invoker-proxy-binding allowing an

    MDB to make multiple subscriptions.

     

    NOTE: The spec defined activation config properties are also supported,

    these override the values here.

     

    Example config (see conf/standardjboss.xml)

        <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>true</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>
    

     

    Parameters

    • name
      - Used to identify the configuration

    • invoker-mbean
      - Only used in the mbean name for mdbs

    • proxy-factory
      - The implementation class that invokes the mdb container

    • proxy-factory-config
      - XML passed to the proxy factory

      • JMSProviderAdapterJNDI
        - The jndi name of the jms provider see

        ProviderName

        .

      • ServerSessionPoolJNDI
        - The name of the

        ServerSessionPool

        loader

      • CreateJBossMQDestination
        - Whether the destination should be created within JBossMQ if it is not in jndi (true or false - default true)

      • MinimumSize
        - The minimum number of threads that remain active to invoke on the mdb (default 1)

      • MaxmimumSize
        - The maximum number of threads that invoke on the mdb concurrently, and the number of sessions created at deployment (default 15)

      • KeepAliveMillis
        - The time that threads remain active when they are not used (above the minimum) (default 30 seconds)

      • MaxMessages
        - The number of messages to wait for before attempting delivery of the session, each message is still delivered in a separate transaction (default 1)

      • MDBConfig

        • ReconnectIntervalSec
          - The length of time after a connection error occurs before it attempts to reconnect (default 10 seconds)

        • DeliveryActive
          - Whether the MDB should make the subscription at initial deployment or wait for

          start/stopDelivery

          on the MBean (true or false - default true)

        • DLQConfig
          - Configuration about the DLQ - remove this to disable the DLQ

          • DestinationQueue
            - The DLQ jndi binding (relative the jndi context provided by the

            JMSProviderAdapterJNDI

            above)

          • MaxTimesRedelivered
            - The number of redeliveries before the message is sent to the DLQ

          • TimeToLive
            - The time to live of the message sent to the DLQ (default 0 - don't expire the message)

          • DLQUser
            - The user to use when creating the

            QueueConnection

            to the DLQ

          • DLQPassword
            - The password to use when creating the

            QueueConnection

            to the DLQ

     

     

    Container

     

    The MDB container is basically just a stateless session bean, except that there is no

    proxy bound into jndi. Instead the proxy registers itself as a subscription with JMS.

     

    Example config (see conf/standardjboss.xml)

    
        <container-configuration>
          <container-name>Standard Message Driven Bean</container-name>
          <call-logging>false</call-logging>
          <invoker-proxy-binding-name>message-driven-bean</invoker-proxy-binding-name>
          <container-interceptors>
            <interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
            <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
            <interceptor>org.jboss.ejb.plugins.RunAsSecurityInterceptor</interceptor>
            <!-- CMT -->
            <interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
            <interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
            <interceptor transaction="Container">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
            <!-- BMT -->
            <interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
            <interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT</interceptor>
            <interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
            <interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
          </container-interceptors>
          <instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
          <instance-cache></instance-cache>
          <persistence-manager></persistence-manager>
          <container-pool-conf>
            <MaximumSize>100</MaximumSize>
          </container-pool-conf>
        </container-configuration>
    

     

    Parameters

    • See the admin docs for most of this

    • instance-pool
      - The implementation of the pool

    • container-pool-conf
      - Configuration passed to the instance pool

      • MaximumSize
        - The maximum number of instances in the pool, unless the pool is strict, new instances will be created after the maximum is reached but won't be pooled (default 100). To prevent creation of unpooled instances see the strictMaximumSize parameter.

      • strictMaximumSize
        - Boolean flag. Whether the

        MaximumSize

        should be strict upper limit. If there are more than

        MaximumSize

        concurrent threads, the excess will block until an instance is free or

        strictTimeout

        is reached.

      • strictTimeout
        - The length of time in milli-seconds to wait for an instance to become available (returned to the pool) before an exception is thrown (default "forever")

     

    General Pooling Notes

     

    In most use cases (common configurations) the delivery server session pool (15 concurrent strictly pooled sessions/threads) throttles the MDB pool (100 instances non strictly pooled) making it irrelevant.

     

    Deployment

     

    The deployment is configured in two files.

    • META-INF/ejb-jar.xml

    • META-INF/jboss.xml

     

    Example

    ejb-jar.xml

    <?xml version="1.0"?>
    
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd">
    
    <ejb-jar>
       <enterprise-beans>
          <message-driven>
             <ejb-name>DurableTopicBean</ejb-name>
             <ejb-class>org.jboss.test.mdb.bean.TopicBean</ejb-class>
             <message-selector>JMSType='activityCompletion'</message-selector>
             <transaction-type>Container</transaction-type>
             <message-driven-destination>
                <destination-type>javax.jms.Topic</destination-type>
                <subscription-durability>Durable</subscription-durability>
             </message-driven-destination>
          </message-driven>
       </enterprise-beans>
       <assembly-descriptor>
          <container-transaction>
             <method>
                <ejb-name>DurableTopicBean</ejb-name>
                <method-name>onMessage</method-name>
             </method>
             <!-- May also be NotSupported -->
             <trans-attribute>Required</trans-attribute>
          </container-transaction>
       </assembly-descriptor>
    </ejb-jar>
    

    jboss.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE jboss PUBLIC
          "-//JBoss//DTD JBOSS 4.0//EN"
          "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
    <jboss>
       <enterprise-beans>
          <message-driven>
             <ejb-name>DurableTopicBean</ejb-name>
             <configuration-name>Standard Message Driven Bean</configuration-name>
             <destination-jndi-name>topic/testDurableTopic</destination-jndi-name>
             <mdb-user>john</mdb-user>
             <mdb-passwd>needle</mdb-passwd>
             <mdb-subscription-id>DurableSubscriberExample</mdb-subscription-id>
          </message-driven>
       </enterprise-beans>
    </jboss>
    

     

    Parameters in jboss.xml jboss/enterprise-beans/message-driven

     

    • See the ejb spec and admin docs for most of this

    • activation-config
      - override of the activation-config from ejb-jar.xml

    • destination-jndi-name
      - the jndi binding of the destination relative to the

      JMSProviderAdapterJNDI

       

    • local-jndi-name
      - just used to control the MBean name of the MDB

    • mdb-user
      - the user id passed to

      createConnection

       

    • mdb-passwd
      - the password passed to

      createConnection

       

    • mdb-client-id
      - the client id passed to the connection (especially important for durable subcriptions that are not pre-configured)

    • mdb-subscription-id
      - the subscription name for durable subscriptions