Alex Rudyy created QPID-8141:
--------------------------------

             Summary: [JMS AMQP 0-x] Routing key and exchange name might not be 
set on address based destinations falsly identified as resolved
                 Key: QPID-8141
                 URL: https://issues.apache.org/jira/browse/QPID-8141
             Project: Qpid
          Issue Type: Bug
          Components: JMS AMQP 0-x
    Affects Versions: qpid-java-client-0-x-6.3.0
            Reporter: Alex Rudyy


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:
{noformat}
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)
{noformat}

The clients applications creating new destination objects on every publishing 
attempt using the same session are impacted by the issue.
The following code snippet demonstrate the problem:
{code}
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();
{code}

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. 
{code}
destination.queue=ADDR:test;"create":"always","node":"type":"queue","durable":true}}
{code}

{code}
Destination destination = (Destination)context.lookup("queue")
{code}
  





--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to