5 Replies Latest reply on Jun 13, 2008 4:55 AM by gary chen

    Can JBoss Messaging uses direct method invocation while send

    gary chen Newbie

      I am now using JBoss Messaging as a JMS server in my application and I don't use any Cluster feature now and this application is deployed on JBoss AS 4.2.2.GA. In my application I use JMS API to send messages and receive messages in a Servlet, that means the JMS client and JMS server are in the same JVM, as shown below :

      |-------------------------------------------|
      | JVM |
      | |
      | |---------------| |---------------| |
      | | Servlet 1 | | Servlet 2 | |
      | | | | | |
      | | |-----------| | | |-----------| | |
      | | | Sender | | | | Receiver | | |
      | | | Client | | | | Client | | |
      | | |-----------| | | |-----------| | |
      | | | | | /|\ | |
      | |------|--------| |-----|---------| |
      | | | |
      | | | |
      | |----- | |---| |
      | | | |
      | \|/ | |
      | |-------------------| |
      | | | |
      | | | |
      | | JMS Server | |
      | | | |
      | |-------------------| |
      | |
      |--------------------------------------------

      I know we can optimize the Send Cilent (or Receive Cilent) and JMS Server not to use Socket (TCP/IP) while sending (or receiving) messages in this case, for example JBoss MQ uses a JVM connection factory which JNDI name is java:/ConnectionFactory to make client JMS API uses direct method invocation while sending or receiving messages.

      Could you please tell me if there is any mechanism to achieve the optimize in this case ?
      And I know there is two connection factories which JNDI name are java:/ConnectionFactory and java:/XAConnectionFactory, are them play the same role as in JBoss MQ? We just use (look up) these connection factories and then we can send or receive messages using direct method invocation and we still using the JMS API in the application, is it right ? Or I can use another way ? Or the JBoss Messaging client will achieve the optimize automatic when it determine the JMS client and the JMS server is in the same JVM ? And how it determine ?
      I couldn't find my answer from the User Guide.