Bug 726100

Summary: Different behaviour of python client when trying to create already existing exchange
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: python-qpidAssignee: messaging-bugs <messaging-bugs>
Status: NEW --- QA Contact: MRG Quality Engineering <mrgqe-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.0CC: 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:

Description Petr Matousek 2011-07-27 14:32:38 UTC
Description of problem:

When trying to create an exchange of different type with the same name as already existing exchange, no error message is displayed and return code is equal to 0 using the python client.

Following error is displayed using other clients (see additional info):
Create failed for exchange ex; not-allowed: not-allowed: Exchange declared to be of type topic, requested fanout (qpid/broker/SessionAdapter.cpp:125)

All the clients behaves the same way.

This was seen on RHEL6.1 x86_64, MRG 2.0 installed (this issue is also valid for MRG 1.3 branch)

Version-Release number of selected component (if applicable):
python-qpid-0.10-1.el6.noarch

How reproducible:
100%

Steps to Reproduce:
1. spout "ex;{create: always,node:{type: topic,x-declare:{type:topic}}}" 
2. spout "ex;{create: always,node:{type: topic,x-declare:{type:fanout}}}" 
3. echo $?
  
Actual results:
No error message displayed, return value is equal to 0

Expected results:
Error message is displayed, return value is non-zero

Additional info:

# qpid-config add exchange topic ex
# qpid-config add exchange fanout ex
Failed: SessionException: ExecutionException(error_code=530, command_id=serial(66), class_code=7, command_code=1, field_index=0, description=u'not-allowed: Exchange declared to be of type topic, requested fanout (qpid/broker/SessionAdapter.cpp:125)', error_info={}, channel=1, id=serial(64))
# echo $?
1
# $cppapi/spout "ex;{create: always,node:{type: topic,x-declare:{type:fanout}}}"
2011-07-27 16:21:13 warning Exception received from broker: not-allowed: not-allowed: Exchange declared to be of type topic, requested fanout (qpid/broker/SessionAdapter.cpp:125) [caused by 1 \x07:\x01]
Create failed for exchange ex; not-allowed: not-allowed: Exchange declared to be of type topic, requested fanout (qpid/broker/SessionAdapter.cpp:125)
2011-07-27 16:21:13 warning Ignoring frame while closing connection: Frame[BEbe; channel=1; {SessionDetachBody: name=959240af-e62a-4419-bb9a-16b879cba06f; }]
# echo $?
1
# java -cp $CLASSPATH org.apache.qpid.example.Drain "ex;{create: always,node:{type: topic,x-declare:{type:fanout}}}"
{}
IoReceiver - localhost/127.0.0.1:5672 2011-07-27 16:21:14,857 ERROR [apache.qpid.client.AMQConnection] Throwable Received but no listener set: org.apache.qpid.AMQException: ch=0 id=1 ExecutionException(errorCode=NOT_ALLOWED, commandId=1, classCode=7, commandCode=1, fieldIndex=0, description=not-allowed: Exchange declared to be of type topic, requested fanout (qpid/broker/SessionAdapter.cpp:125), errorInfo={}) [error code 530: not allowed]
IoReceiver - localhost/127.0.0.1:5672 2011-07-27 16:21:14,859 WARN [apache.qpid.transport.SessionDelegate] CLOSED: [ssn:"299fb509-5612-4968-b7dc-6b5fd4353827"]
main 2011-07-27 16:21:14,859 ERROR [apache.qpid.client.AMQConnection] Throwable Received but no listener set: org.apache.qpid.AMQException: ch=0 id=1 ExecutionException(errorCode=NOT_ALLOWED, commandId=1, classCode=7, commandCode=1, fieldIndex=0, description=not-allowed: Exchange declared to be of type topic, requested fanout (qpid/broker/SessionAdapter.cpp:125), errorInfo={}) [error code 530: not allowed]
Exception in thread "main" javax.jms.JMSException: Error registering consumer: org.apache.qpid.AMQException: ch=0 id=1 ExecutionException(errorCode=NOT_ALLOWED, commandId=1, classCode=7, commandCode=1, fieldIndex=0, description=not-allowed: Exchange declared to be of type topic, requested fanout (qpid/broker/SessionAdapter.cpp:125), errorInfo={}) [error code 530: not allowed]
	at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2052)
	at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:1995)
	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.createConsumerImpl(AMQSession.java:1993)
	at org.apache.qpid.client.AMQSession.createConsumer(AMQSession.java:965)
	at org.apache.qpid.example.Drain.<init>(Drain.java:70)
	at org.apache.qpid.example.Drain.main(Drain.java:103)
Caused by: org.apache.qpid.AMQException: ch=0 id=1 ExecutionException(errorCode=NOT_ALLOWED, commandId=1, classCode=7, commandCode=1, fieldIndex=0, description=not-allowed: Exchange declared to be of type topic, requested fanout (qpid/broker/SessionAdapter.cpp:125), errorInfo={}) [error code 530: not allowed]
	at org.apache.qpid.client.AMQSession_0_10.setCurrentException(AMQSession_0_10.java:1031)
	at org.apache.qpid.client.AMQSession_0_10.sync(AMQSession_0_10.java:1011)
	at org.apache.qpid.client.AMQSession_0_10.sendExchangeDeclare(AMQSession_0_10.java:716)
	at org.apache.qpid.client.AMQSession_0_10.handleAddressBasedDestination(AMQSession_0_10.java:1223)
	at org.apache.qpid.client.AMQSession.registerConsumer(AMQSession.java:2836)
	at org.apache.qpid.client.AMQSession.access$500(AMQSession.java:120)
	at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2029)
	... 8 more
# echo $?
1
# $pyapi/spout "ex;{create: always,node:{type: topic,x-declare:{type:fanout}}}" 
Message(properties={'spout-id': 'a1d74362-7ffb-495e-b7bc-e5e33bcb216e:0'})
# echo $?
0