4 Replies Latest reply on Nov 29, 2005 2:09 PM by adrian.brock

    Producers/Consumers and managed jms connections

    timfox

      If obtaining jms connections via the jms jca adapter, the session maps 1-1 to the managed connection and are pooled.

      The consumers and producers of the session don't seem to be cached though.

      So every time I call createConsumer(), createProducer() on a org.jboss.resource.adapter.jms.Session object it it seems to be going to the JMS provider to create the consumer/producer.

      E.g. if I wanted to send a message to another destination every time an MDB onMessage method is executed, I would actually get a new producer created for every message send.

      Although producer/consumer creation is lightweight compared to connection creation it still requires a jms server hit in jboss-messaging (I'm not sure whether it's handled locally in JBossMQ)

      So I'm thinking this could cause a performance problem.

      Is there any reason why the org.jboss.resource.adapter.jms.Session can't return Consumer/Producer objects from it's cache when a create consumer/producer is requested? These could be keyed on the creation parameters?

        • 1. Re: Producers/Consumers and managed jms connections

           

          "timfox" wrote:

          Although producer/consumer creation is lightweight compared to connection creation it still requires a jms server hit in jboss-messaging (I'm not sure whether it's handled locally in JBossMQ)


          Yes it is handled locally/lazily in JBossMQ for producers.
          It validates whether the destination really exists on the send.

          For consumers you obviously need to go the server anyway to create the "subscription".
          Which must be physically removed on logical close of the jms connection. Even if the
          session/connection isn't physically closed.

          • 2. Re: Producers/Consumers and managed jms connections
            timfox

            So we need to make sure we're caching producers for the session or performance is going to suck for jboss messaging.

            BTW What is the use case for creating a consumer from an EJB using JCA?

            • 3. Re: Producers/Consumers and managed jms connections

               

              "timfox" wrote:
              So we need to make sure we're caching producers for the session or performance is going to suck for jboss messaging.

              No you should look at optimizing your processing rather than expecting
              some other layer to fix the problem.

              BTW What is the use case for creating a consumer from an EJB using JCA?


              You can only use receive() methods according to the j2ee spec
              see the example ejb on the WIKI provided by a user.


              • 4. Re: Producers/Consumers and managed jms connections

                NOTE also. A JCA resource adapter can be used outside a J2EE appserver.

                You supply your own connection manager to give it your own semantics
                or hope the resource adapter has an internal implementation.