Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-8141

[JMS AMQP 0-x] Sending message to address based destinations that matches the address of a previously resolved address fails

    XMLWordPrintableJSON

Details

    Description

      Address based destination resolution functionality AMQSession#resolveAddress sets a number of fields like routing key, exchange name, etc as part of invocation of AMQSession#setLegacyFieldsForQueueType. If destination object is identified as resolved AMQSession#isResolved the essential fields are not set on the destination object. As result, publishing attempts with such destination objects will fail due to routing issues like the one reported below:

      Caused by: org.apache.qpid.AMQConnectionClosedException: Error: No route for message with exchange 'null' and routing key 'null' [error code: 312(no route)]
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      	at org.apache.qpid.AMQException.cloneForCurrentThread(AMQException.java:81)
      	at org.apache.qpid.AMQException.cloneForCurrentThread(AMQException.java:24)
      	at org.apache.qpid.client.AMQProtocolHandler.writeCommandFrameAndWaitForReply(AMQProtocolHandler.java:638)
      	at org.apache.qpid.client.AMQProtocolHandler.syncWrite(AMQProtocolHandler.java:675)
      	at org.apache.qpid.client.AMQProtocolHandler.syncWrite(AMQProtocolHandler.java:669)
      	at org.apache.qpid.client.AMQSession_0_8.commitImpl(AMQSession_0_8.java:271)
      	at org.apache.qpid.client.AMQSession.commit(AMQSession.java:913)
      	... 6 more
      Caused by: org.apache.qpid.AMQConnectionClosedException: Error: No route for message with exchange 'null' and routing key 'null' [error code: 312(no route)]
      	at org.apache.qpid.client.handler.ConnectionCloseMethodHandler.methodReceived(ConnectionCloseMethodHandler.java:90)
      	at org.apache.qpid.client.handler.ClientMethodDispatcherImpl.dispatchConnectionClose(ClientMethodDispatcherImpl.java:227)
      	at org.apache.qpid.framing.ConnectionCloseBody.execute(ConnectionCloseBody.java:105)
      	at org.apache.qpid.client.state.AMQStateManager.methodReceived(AMQStateManager.java:118)
      	at org.apache.qpid.client.AMQProtocolHandler.methodBodyReceived(AMQProtocolHandler.java:531)
      	at org.apache.qpid.client.protocol.AMQProtocolSession.methodFrameReceived(AMQProtocolSession.java:460)
      	at org.apache.qpid.framing.AMQMethodBodyImpl.handle(AMQMethodBodyImpl.java:66)
      	at org.apache.qpid.client.AMQProtocolHandler.received(AMQProtocolHandler.java:480)
      	at org.apache.qpid.client.AMQConnectionDelegate_8_0$ReceiverClosedWaiter.received(AMQConnectionDelegate_8_0.java:549)
      	at org.apache.qpid.transport.network.io.IoReceiver.run(IoReceiver.java:164)
      	at java.lang.Thread.run(Thread.java:748)
      

      The clients applications creating new destination objects on every publishing attempt using the same session are impacted by the issue.  Problems occurs for both 0-10 and 0-8..0-91.
      The following code snippet demonstrate the problem:

      MessageProducer messageProducer = session.createProducer(null);
      for (int i=0;i<numberOfMessages;i++)
      {
          Message message = session.createTextMessage("Test");
          messageProducer.send(session.createQueue(String.format(
                  "ADDR:test;{\"create\":\"always\",\"node\":{\"type\":\"queue\",\"durable\":true}}")), message);
      }
      session.commit();
      

      The work around would be to avoid creation of destination objects every time. For example, Qpid JNDI properties can be used to declare and cache the destination objects.

      destination.queue=ADDR:test;{"create":"always","node":"type":"queue","durable":true}}
      
      Destination destination = (Destination)context.lookup("queue")
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            orudyy Alex Rudyy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: