2 Replies Latest reply on Jul 18, 2007 7:13 AM by Terry Paterson

    Single MDB Instance Required

    Saeed Kabiri Newbie

      Hello community,

      i am developing an Event Driven architecture using j2ee (MDB) on JBoss. In this Architecture the incoming business events (raw events) will be fetched by a MDB, wich forward the raw events to Event Stream Processor. My Problem is that JBoss instantiate multiple instances of my MDB. It means the same event will be delivered repeatedly. I just tried to force JBoss to limit the number of MDB instances. But it was useless. My jboss.xml look like this:
      <?xml version="1.0"?>
      <!DOCTYPE jboss PUBLIC
      "-//JBoss//DTD JBOSS 3.2//EN"
      "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
      <!-- The jboss.xml descriptor for the jrmp-comp.jar ejb unit -->

      <enterprise-beans>
      <message-driven>
      <ejb-name>EventInputAdapterBean</ejb-name>
      <destination-jndi-name>topic/rawEventTopic</destination-jndi-name>
      <configuration-name>Standard Message Driven Bean</configuration-name>

      <invoker-bindings>

      <invoker-proxy-binding-name>event-message-driven-bean</invoker-proxy-binding-name>

      </invoker-bindings>
      </message-driven>
      <message-driven>
      <ejb-name>ComplexEventInputAdapterBean</ejb-name>
      <destination-jndi-name>topic/complexEventTopic</destination-jndi-name>
      <configuration-name>Standard Message Driven Bean</configuration-name>
      <invoker-bindings>

      <invoker-proxy-binding-name>event-message-driven-bean</invoker-proxy-binding-name>

      </invoker-bindings>
      </message-driven>
      </enterprise-beans>

      <invoker-proxy-bindings>
      <invoker-proxy-binding>
      event-message-driven-bean
      <invoker-mbean>default</invoker-mbean>
      <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
      <proxy-factory-config>
      DefaultJMSProvider
      StdJMSPool
      1
      1

      10

      queue/DLQ
      10
      0


      </proxy-factory-config>
      </invoker-proxy-binding>
      </invoker-proxy-bindings>


      i also made some changes in conf/jbossstandard.xml. The referenced configuration "Standard Message Driven Bean" like following:
      <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>
      org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor
      org.jboss.ejb.plugins.LogInterceptor
      org.jboss.ejb.plugins.RunAsSecurityInterceptor
      <!-- CMT -->
      org.jboss.ejb.plugins.TxInterceptorCMT
      org.jboss.ejb.plugins.CallValidationInterceptor
      org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor
      <!-- BMT -->
      org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor
      org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT
      org.jboss.ejb.plugins.CallValidationInterceptor
      org.jboss.resource.connectionmanager.CachedConnectionInterceptor
      </container-interceptors>
      <instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
      <instance-cache></instance-cache>
      <persistence-manager></persistence-manager>
      <container-pool-conf>
      1
      true

      </container-pool-conf>
      </container-configuration>


      can you please tell me, what my mistake is.

      thanks
      Saeed

        • 1. Re: Single MDB Instance Required
          Saeed Kabiri Newbie

          please ignor the above post. Some xml tags are deleted. the following is the correct one:

          i am developing an Event Driven architecture using j2ee (MDB) on JBoss. In this Architecture the incoming business events (raw events) will be fetched by a MDB, wich forward the raw events to Event Stream Processor. My Problem is that JBoss instantiate multiple instances of my MDB. It means the same event will be delivered repeatedly. I just tried to force JBoss to limit the number of MDB instances. But it was useless. My jboss.xml look like this:

          <?xml version="1.0"?>
          <!DOCTYPE jboss PUBLIC
           "-//JBoss//DTD JBOSS 3.2//EN"
           "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
          <!-- The jboss.xml descriptor for the jrmp-comp.jar ejb unit -->
          <jboss>
           <enterprise-beans>
           <message-driven>
           <ejb-name>EventInputAdapterBean</ejb-name>
           <destination-jndi-name>topic/rawEventTopic</destination-jndi-name>
           <configuration-name>Standard Message Driven Bean</configuration-name>
          
           <invoker-bindings>
           <invoker>
           <invoker-proxy-binding-name>event-message-driven-bean</invoker-proxy-binding-name>
           </invoker>
           </invoker-bindings>
           </message-driven>
           <message-driven>
           <ejb-name>ComplexEventInputAdapterBean</ejb-name>
           <destination-jndi-name>topic/complexEventTopic</destination-jndi-name>
           <configuration-name>Standard Message Driven Bean</configuration-name>
           <invoker-bindings>
           <invoker>
           <invoker-proxy-binding-name>event-message-driven-bean</invoker-proxy-binding-name>
           </invoker>
           </invoker-bindings>
           </message-driven>
           </enterprise-beans>
          
           <invoker-proxy-bindings>
           <invoker-proxy-binding>
           <name>event-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>
           <MaximumSize>1</MaximumSize>
           <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>
           </invoker-proxy-bindings>
          
          </jboss>
          


          i also made some changes in conf/jbossstandard.xml. The referenced configuration "Standard Message Driven Bean" like following:
           <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>1</MaximumSize>
           <strictMaximumSize>true</strictMaximumSize>
          
           </container-pool-conf>
           </container-configuration>
          
          

          can you please tell me, what my mistake is.

          thanks
          Saeed


          • 2. Re: Single MDB Instance Required
            Terry Paterson Newbie

            Sounds like you want to change your MDB to use the "Singleton Message Driven Bean" container configuration.