mq
  1. mq
  2. MQ-264

Async receiver does not receive the message

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Here is a trivial MessageSender:

      @Stateless
      public class MessageSender {
      
          @Inject
          JMSContext context;
      
          @Resource(lookup = "java:global/jms/myQueue")
          Queue queue;
      
          public void sendMessage(String message) {
              context.createProducer().send(queue, message);
          }
      }
      

      The following message receiver works fine:

      @Stateless
      public class MessageReceiverSync {
      
          @Inject
          private JMSContext context;
      
          @Resource(lookup = "java:global/jms/myQueue")
          Queue myQueue;
      
          public String receiveMessage() {
              String message = context.createConsumer(myQueue).receiveBody(String.class, 1000);
              return "Received " + message;
          }
      }
      

      But the following one does not receive the message:

      @MessageDriven(mappedName = "java:global/jms/myQueue")
      public class MessageReceiverAsync implements MessageListener {
      
          @Override
          public void onMessage(Message message) {
              try {
                  TextMessage tm = (TextMessage) message;
                  System.out.println("Message received: " + tm.getText());
              } catch (JMSException ex) {
      Logger.getLogger(MessageReceiverAsync.class.getName()).log(Level.SEVERE, null, ex);
              }
          }
      } 
      

      The destination definition is defined as:

      @JMSDestinationDefinition(name = "java:global/jms/myQueue",
              resourceAdapterName = "jmsra",
              className = "javax.jms.Queue",
              destinationName="java:global/jms/myQueue",
              description="My Queue")
      @WebServlet(name = "TestServlet", urlPatterns = {"/TestServlet"})
      public class TestServlet extends HttpServlet {
      

        Issue Links

          Activity

          Hide
          Ed Bratt added a comment -

          Please investigate

          Show
          Ed Bratt added a comment - Please investigate
          Hide
          David Zhao added a comment -

          destinationName in the annotation definition should be the physical destination name, "java:global/jms/myQueue" may be not suitable for that.

          Show
          David Zhao added a comment - destinationName in the annotation definition should be the physical destination name, "java:global/jms/myQueue" may be not suitable for that.
          Hide
          amyk added a comment -

          Arun's following blog seems to indicate this jira is still an issue for the sample @JMSDestinationDefinition in the blog appears using correct destinationName attribute setting
          https://blogs.oracle.com/arungupta/entry/simple_jms_2_0_sample

          emailed Arun to confirm

          Show
          amyk added a comment - Arun's following blog seems to indicate this jira is still an issue for the sample @JMSDestinationDefinition in the blog appears using correct destinationName attribute setting https://blogs.oracle.com/arungupta/entry/simple_jms_2_0_sample emailed Arun to confirm
          Hide
          arungupta added a comment -

          Confirmed with b68.

          Show
          arungupta added a comment - Confirmed with b68.
          Hide
          arungupta added a comment -

          Here is the updated annotation:

          @JMSDestinationDefinition(name = "java:global/jms/myQueue",
          resourceAdapterName = "jmsra",
          className = "javax.jms.Queue",
          destinationName="queue1234",
          description="My Queue")
          @WebServlet(urlPatterns =

          {"/TestServlet"}

          )
          public class TestServlet extends HttpServlet {

          Show
          arungupta added a comment - Here is the updated annotation: @JMSDestinationDefinition(name = "java:global/jms/myQueue", resourceAdapterName = "jmsra", className = "javax.jms.Queue", destinationName="queue1234", description="My Queue") @WebServlet(urlPatterns = {"/TestServlet"} ) public class TestServlet extends HttpServlet {
          Hide
          amyk added a comment - - edited

          This is a GlassFish server side bug - The MDB for the async sample listens on a Topic whereas the @JMSDestintionDefinition specifies it as className="javax.jms.Queue" (see below JMSRA debug logging in server.log). If send a message to Topic 'queue1234', the MDB receives the message.

          A GlassFish jira issue is filed: GLASSFISH-19492

          ----- imqcmd list dst with the sample war deployed
          queue1234 Topic RUNNING 0 0 1 0 0 0 0 0 0.0

          ----- server.log
          [#|2013-01-02T21:44:34.547-0800|FINER|44.0|javax.resourceadapter.mqjmsra.inbound.message|_ThreadID=73;_ThreadName=admin-listener
          (2);_TimeMillis=1357191874547;_LevelValue=400;ClassName=com.sun.messaging.jms.ra.ResourceAdapter;MethodName=endpointActivation()
          ;|ENTRY my:my:MessageReceiverAsync ActvationSpec configuration=
          DestinationType =javax.jms.Topic
          Destination =queue1234
          MessageSelector =null
          AcknowledgeMode =Auto-acknowledge
          SubscriptionDurability =NonDurable
          useSharedSubscriptionInClusteredContainer=true
          ClientId =null
          SubscriptionName =null
          EndpointPoolMaxSize =32
          EndpointPoolSteadySize =0
          EndpointPoolResizeCount =8
          EndpointPoolResizeTimeout =600
          EndpointExceptionRedeliveryAttempts =1
          EndpointExceptionRedeliveryInterval =500
          SendUndeliverableMsgsToDMQ =true
          GroupName =null
          RAUID =null
          InClusteredContainer =false
          MdbName =null
          UserName =null
          AddressList (configured) =null
          AddressList (in effect) =localhost:7676
          addressListBehavior (configured) =null
          addressListBehavior (in effect) =PRIORITY
          addressListIterations (configured) =0
          addressListIterations (in effect) =3
          reconnectAttempts (configured) =0
          reconnectAttempts (in effect) =3
          reconnectInterval (configured) =0
          reconnectInterval (in effect) =5000
          options =null

          #]
          Show
          amyk added a comment - - edited This is a GlassFish server side bug - The MDB for the async sample listens on a Topic whereas the @JMSDestintionDefinition specifies it as className="javax.jms.Queue" (see below JMSRA debug logging in server.log). If send a message to Topic 'queue1234', the MDB receives the message. A GlassFish jira issue is filed: GLASSFISH-19492 ----- imqcmd list dst with the sample war deployed queue1234 Topic RUNNING 0 0 1 0 0 0 0 0 0.0 ----- server.log [#|2013-01-02T21:44:34.547-0800|FINER|44.0|javax.resourceadapter.mqjmsra.inbound.message|_ThreadID=73;_ThreadName=admin-listener (2);_TimeMillis=1357191874547;_LevelValue=400;ClassName=com.sun.messaging.jms.ra.ResourceAdapter;MethodName=endpointActivation() ;|ENTRY my:my:MessageReceiverAsync ActvationSpec configuration= DestinationType =javax.jms.Topic Destination =queue1234 MessageSelector =null AcknowledgeMode =Auto-acknowledge SubscriptionDurability =NonDurable useSharedSubscriptionInClusteredContainer=true ClientId =null SubscriptionName =null EndpointPoolMaxSize =32 EndpointPoolSteadySize =0 EndpointPoolResizeCount =8 EndpointPoolResizeTimeout =600 EndpointExceptionRedeliveryAttempts =1 EndpointExceptionRedeliveryInterval =500 SendUndeliverableMsgsToDMQ =true GroupName =null RAUID =null InClusteredContainer =false MdbName =null UserName =null AddressList (configured) =null AddressList (in effect) =localhost:7676 addressListBehavior (configured) =null addressListBehavior (in effect) =PRIORITY addressListIterations (configured) =0 addressListIterations (in effect) =3 reconnectAttempts (configured) =0 reconnectAttempts (in effect) =3 reconnectInterval (configured) =0 reconnectInterval (in effect) =5000 options =null #]
          Hide
          amyk added a comment -

          Close as duplicated of GLASSFISH-19492

          Show
          amyk added a comment - Close as duplicated of GLASSFISH-19492

            People

            • Assignee:
              amyk
              Reporter:
              arungupta
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: