0 Replies Latest reply on Nov 7, 2002 10:53 AM by Erik

    Multiple MDB Instances Receive Same Message From Topic

    Erik Newbie

      Hello,

      I've got a problem for which I hope there is a simple solution. I've written an MDB whose main purpose is to archive messages to a database. It subscribes to a topic via a non-durable subscription (will be changed to a durable subscription later). My problem is that JBoss instantiates multiple instances of my bean and when a message arrives, all of the instances receive a copy of it and they all create a record in the database. I can't convert the topic to a queue because other clients subscribe to the topic and need access to the same message.

      Has anyone else run into this type of scenario? Any recommendations? Can I prevent JBoss from instantiating my bean multiple times (not very scalable, I know)?

      Here's my current JBoss.xml from the bean:


      <enterprise-beans>
      <message-driven>
      <ejb-name>MDBArchiver</ejb-name>
      <configuration-name>Archiver Messagage Driven Bean</configuration-name>
      <destination-jndi-name>topic/mytopic</destination-jndi-name>
      </message-driven>
      </enterprise-beans>
      <container-configurations>
      <container-configuration extends="Standard Message Driven Bean">
      <container-name>Archiver Messagage Driven Bean</container-name>
      <container-pool-conf>
      1
      1
      true
      </container-pool-conf>
      </container-configuration>
      </container-configurations>