Bug 1006976

Summary: [amqp1.0] consumer subscribed to xml exchange using xquery filter acquires always the same message
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: qpid-cppAssignee: Gordon Sim <gsim>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Matousek <pematous>
Severity: high Docs Contact:
Priority: medium    
Version: DevelopmentCC: esammons, iboverma, jross
Target Milestone: 3.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-cpp-0.22-14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-21 12:55:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1010399    

Description Petr Matousek 2013-09-11 15:43:56 UTC
Description of problem:

When a consumer is subscribed for receiving messages from xml exchange using xquery filter, he always acquires the same message after the first matching message is delivered to him.

Version-Release number of selected component (if applicable):
qpid-cpp-*-0.22-13.el6

How reproducible:
100%

Steps to Reproduce:
1. declare exchange of type xml
# qpid-config add exchange xml xml
2. subscribe to the xml exchange using xquery-filter
# ./drain -f --connection-options "{protocol: 'amqp1.0'}" "xml;{link:{filter:{value:\"./colour='red' or ./colour='black'\",name:'name',descriptor:'apache.org:xquery-filter:string'}}}"
3. send two messages matching the filter with different content using 0-10 publisher
# ./spout --content '<colour>'red'</colour>' xml
# ./spout --content '<colour>'black'</colour>' xml
4. two messages are received (as expected), but the second message is the same message as the first one

Note: The behavior is the same when another client (ie. qpid-send) is used

Please see additional info for more details.

Actual results:
Only the first message matching the filter on the xml exchange subscription is delivered to the consumer. When another message matching the filter is published to the xml exchange, the consumer acquires again the first message (that was already deliver to him).

Expected results:
All the messages matching the filter are delivered to the consumer

Additional info:

term1 (consumer):
# qpid-config add exchange xml xml
# ./drain -f --connection-options "{protocol: 'amqp1.0'}" "xml;{link:{filter:{value:\"./colour='red' or ./colour='black'\",name:'name',descriptor:'apache.org:xquery-filter:string'}}}"
Message(properties={spout-id:8057661c-0e63-45a3-8275-4713175cd0c4:0, x-amqp-to:xml}, content='<colour>red</colour>')
Message(properties={spout-id:8057661c-0e63-45a3-8275-4713175cd0c4:0, x-amqp-to:xml}, content='<colour>red</colour>')

term2 (publisher):
# ./spout --content '<colour>'red'</colour>' xml
# ./spout --content '<colour>'black'</colour>' xml

Comment 1 Gordon Sim 2013-09-11 16:20:12 UTC
This is fixed by https://bugzilla.redhat.com/show_bug.cgi?id=1004002

A workaround is to explicitly clear the message after each fetch, e.g. by adding

  message = Message();

at the end of the while loop in drain.cpp

Comment 2 Petr Matousek 2013-10-25 15:15:13 UTC
This issue has been fixed. Verified on rhel6.4 (i386, x86_64).

packages used for testing:
qpid-cpp-*-0.22-22.el6