Bug 735334

Summary: type 'topic' is used as default on exchange assertion with java client (different behavior of client)
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: qpid-javaAssignee: messaging-bugs <messaging-bugs>
Status: NEW --- QA Contact: MRG Quality Engineering <mrgqe-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: DevelopmentCC: jross
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Matousek 2011-09-02 11:50:15 UTC
Description of problem:

Java clients (Spout/Drain) fails to resolve the exchange address, if the type of the exchange is not explicitly specified in the address string and the type is different from default exchange type (topic).

It is possible to specify the type of exchange in the address string which actually solves the problem. So the following command succeeds:

java -cp $CLASSPATH org.apache.qpid.example.Spout "ex_direct;{ assert:always, node:{type: topic,x-declare:{type:direct}}}"

It is not necessary to specify the exchange type either with cpp or with python clients. All the clients behaves the same way.

Version-Release number of selected component (if applicable):
qpid-java-0.10-6

How reproducible:
100%

Steps to Reproduce:
1. qpid-config add exchange direct ex_direct
2. java -cp $CLASSPATH org.apache.qpid.example.Spout "ex_direct;{ assert:always}"
3. AMQException: The name 'ex_direct' supplied in the address doesn't resolve to an exchange or a queue
  
Actual results:
The exchange type must be explicitly specified in the address string in order to successfully resolve the address

Expected results:
It is not necessary to specify the type of already existing exchange in the address string 

All the clients behaves the same way.

Additional info:

# qpid-config add exchange direct ex_direct

# java -cp $CLASSPATH org.apache.qpid.example.Spout "ex_direct;{ assert:always}"
{}
Exception in thread "main" javax.jms.JMSException: Error creating producer
	at org.apache.qpid.client.AMQSession_0_10.createMessageProducer(AMQSession_0_10.java:681)
	at org.apache.qpid.client.AMQSession_0_10.createMessageProducer(AMQSession_0_10.java:82)
	at org.apache.qpid.client.AMQSession$6.execute(AMQSession.java:2599)
	at org.apache.qpid.client.AMQSession$6.execute(AMQSession.java:2594)
	at org.apache.qpid.client.AMQConnectionDelegate_0_10.executeRetrySupport(AMQConnectionDelegate_0_10.java:314)
	at org.apache.qpid.client.AMQConnection.executeRetrySupport(AMQConnection.java:622)
	at org.apache.qpid.client.failover.FailoverRetrySupport.execute(FailoverRetrySupport.java:102)
	at org.apache.qpid.client.AMQSession.createProducerImpl(AMQSession.java:2592)
	at org.apache.qpid.client.AMQSession.createProducerImpl(AMQSession.java:2586)
	at org.apache.qpid.client.AMQSession.createProducer(AMQSession.java:1199)
	at org.apache.qpid.client.AMQSession.createProducer(AMQSession.java:120)
	at org.apache.qpid.example.Spout.<init>(Spout.java:91)
	at org.apache.qpid.example.Spout.main(Spout.java:146)
Caused by: org.apache.qpid.AMQException: Exception occured while verifying destination
	at org.apache.qpid.client.BasicMessageProducer_0_10.declareDestination(BasicMessageProducer_0_10.java:90)
	at org.apache.qpid.client.BasicMessageProducer.<init>(BasicMessageProducer.java:141)
	at org.apache.qpid.client.BasicMessageProducer_0_10.<init>(BasicMessageProducer_0_10.java:65)
	at org.apache.qpid.client.AMQSession_0_10.createMessageProducer(AMQSession_0_10.java:676)
	... 12 more
Caused by: org.apache.qpid.AMQException: The name 'ex_direct' supplied in the address doesn't resolve to an exchange or a queue
	at org.apache.qpid.client.AMQSession_0_10.handleAddressBasedDestination(AMQSession_0_10.java:1237)
	at org.apache.qpid.client.BasicMessageProducer_0_10.declareDestination(BasicMessageProducer_0_10.java:86)
	... 15 more

# java -cp $CLASSPATH org.apache.qpid.example.Spout "ex_direct;{ assert:always, node:{type: topic,x-declare:{type:direct}}}"
{}

------------- Msg -------------
Body:

JMS Correlation ID: null
JMS timestamp: 1314963279290
JMS expiration: 0
JMS priority: 4
JMS delivery mode: 2
JMS reply to: null
JMS Redelivered: false
JMS Destination: 'ex_direct'/None; {
  'assert': 'always',
  'node': {
    'type': 'topic',
    'x-declare': {
      'type': 'direct'
    }
  }
}
JMS Type: null
JMS MessageID: ID:ef37f31d-e711-3a8d-a6a7-822f0ad44df6
JMS Content-Type: text/plain
AMQ message number: -1
Properties:
	qpid.subject = 

-------------------------------

IoReceiver - localhost/127.0.0.1:5672 2011-09-02 13:34:39,314 WARN [apache.qpid.transport.SessionDelegate] CLOSED: [ssn:"e68d8e16-1dcf-40ba-bdb9-85657981cf42"]