3 Replies Latest reply on Apr 8, 2002 4:03 AM by pra

    ConnectionConsumer and MDB

    fracalde

      Does anybody know how exactly MessageConsumer instances are associated to MDBs in JBoss? Is it like that for each deployed MDB a new TopicConnection is created and a new ConnectionConsumer is associated with it ?

      Thanks

        • 1. Re: ConnectionConsumer and MDB

          Here is the meat from src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java:

          // create a queue connection
          Object qFactory = context.lookup(adapter.getQueueFactoryRef());
          QueueConnection qConnection =
          (QueueConnection)ConnectionFactoryHelper.createQueueConnection
          (qFactory, user, password);
          connection = qConnection;

          // lookup or create the destination queue
          Queue queue =
          (Queue)createDestination(Queue.class,
          context,
          "queue/" + jndiSuffix,
          jndiSuffix);

          // set up the server session pool
          pool = createSessionPool(qConnection,
          maxPoolSize,
          true, // tx
          acknowledgeMode,
          new MessageListenerImpl(this));
          log.debug("server session pool: " + pool);

          // create the connection consumer
          connectionConsumer = qConnection.
          createConnectionConsumer(queue,
          messageSelector,
          pool,
          maxMessagesNr);

          So, yes, for every deployed MDB there is one connection, one consumer and one pool and several sessions (managed by the pool and the consumer).

          //Peter

          • 2. Re: ConnectionConsumer and MDB
            mahonys

            .. but how does the MDB/Container Know which Queue to lookup if the Queue if remote..,e.g. if I want multiple MDB on remote clients to subscribe to single Queue instance on another remote JBoss server?

            SteveM

            • 3. Re: ConnectionConsumer and MDB

              Thats decided by the JMSProviderAdapter, see the docs.

              //Peter