Bug 735329

Summary: No error when creating binding to non-existing queue
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: qpid-javaAssignee: Rajith Attapattu <rattapat+nobody>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Matousek <pematous>
Severity: low Docs Contact:
Priority: low    
Version: DevelopmentCC: iboverma, jross, lzhaldyb
Target Milestone: 2.3   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-java-*-0.18-3 Doc Type: Bug Fix
Doc Text:
Cause: Incorrect error handling causes the addressing code to ignore this issues. Consequence: The application does not get notified that the queue does not exist Fix: Fixed the error handling code to pass the error through to the application. Result: An error is thrown when creating a binding to a non existing queue.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-19 16:39:07 UTC 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:18:12 UTC
Description of problem:

The following address string tries to create binding between amq.direct exchange and non-existing queue. There is no error message displayed on the address execution, return code is equal to zero. The binding is naturally not created, because the queue does not exist.

"amq.direct/key;{ create:always,assert:always, node: { type:topic,x-declare:{type:direct} }, link: { x-bindings: [{ queue: 'non-existing-queue', key: 'key' }] }}"

There is no 

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

How reproducible:
100%

Steps to Reproduce:
1. java -cp $CLASSPATH org.apache.qpid.example.Spout "amq.direct/key;{ create:always,assert:always, node: { type:topic,x-declare:{type:direct} }, link: { x-bindings: [{ queue: 'non-existing-queue', key: 'key' }] }}"
2. the command succeeds, message is sent, but the binding is naturally not created, because the queue does not exist.

Actual results:
There is no error message displayed, return code is equal to zero. The binding is naturally not created, because the queue does not exist.

Expected results:
Error message regarding the queue does not exist shall be displayed, return code is non-zero

Additional info:

java -cp $CLASSPATH org.apache.qpid.example.Spout "amq.direct/key;{ create:always,assert:always, node: { type:topic,x-declare:{type:direct} }, link: { x-bindings: [{ queue: 'non-existing-queue', key: 'key' }] }}"
{}

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

JMS Correlation ID: null
JMS timestamp: 1314961495237
JMS expiration: 0
JMS priority: 4
JMS delivery mode: 2
JMS reply to: null
JMS Redelivered: false
JMS Destination: 'amq.direct'/'key'; {
  'assert': 'always',
  'create': 'always',
  'link': {
    'x-bindings': [
      {
        'key': 'key',
        'queue': 'non-existing-queue'
      }
    ]
  },
  'node': {
    'type': 'topic',
    'x-declare': {
      'type': 'direct'
    }
  }
}
JMS Type: null
JMS MessageID: ID:65bba67a-fb84-3057-91ad-fe3445137b93
JMS Content-Type: text/plain
AMQ message number: -1
Properties:
	qpid.subject = key

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

IoReceiver - localhost/127.0.0.1:5672 2011-09-02 13:04:55,285 WARN [apache.qpid.transport.SessionDelegate] CLOSED: [ssn:"cdb2c1a7-115b-47b0-9b15-b79974f77d37"]
# echo $?
0

Comment 1 Rajith Attapattu 2012-10-18 13:22:47 UTC
This is fixed in upstream
http://svn.apache.org/viewvc?rev=1397651&view=rev

If you run the above test, the client will throw the following exception.

Exception in thread "main" javax.jms.JMSException: Exception while registering consumer:ch=0 id=1 ExecutionException(errorCode=NOT_FOUND, commandId=5, classCode=7, commandCode=4, fieldIndex=0, description=not-found: Bind failed. No such queue: non-existing-queue (qpid/broker/Broker.cpp:1244), errorInfo={})

Comment 4 Petr Matousek 2012-10-27 12:54:52 UTC
This issue has been fixed.

Verified on rhel5.8 and rhel6.3 (x86_64, i386)

packages used for testing:
qpid-java-*-0.18-3

-> VERIFIED