Bug 739979 - Message properties discrepancies using c++ client
Summary: Message properties discrepancies using c++ client
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-cpp
Version: Development
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
: ---
Assignee: messaging-bugs
QA Contact: MRG Quality Engineering
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-20 15:30 UTC by Petr Matousek
Modified: 2013-02-24 13:22 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)

Description Petr Matousek 2011-09-20 15:30:55 UTC
Description of problem:

I have noticed following distinction in the properties of message sent by c++ client:

1.) Empty string is set for user_id
2.) Empty string is set for correlation_id

no value shall be set until specified by user

3.) There is probably something wrong with supplying properties using -P option because they are incorrectly read by python client and they can not be read with java client at all, see below:

# $cppapi/spout -P a=b q
# $pyapi/drain -p "%(P)s" q
{u'a': 'b', 'x-amqp-0-10.routing-key': u'q', u'spout-id': '804bd536-19d3-4b58-9f3a-abd9163c3ae6:0'}  // u'a':u'b' shall be displayed
# java -cp $CLASSPATH org.apache.qpid.example.Drain "q;{mode:browse}"
------------- Msg -------------
...<snip>...
Properties:<NONE>

I also recommend to update the usage to make the input more clear to the user:
-  -P VALUE, --property VALUE    specify message property
+  -P NAME=VALUE --property NAME=VALUE    specify message property
OR
+  -P VALUE, --property VALUE    specify message property in the form name=value

Version-Release number of selected component (if applicable):
qpid-cpp-client-0.10-8

How reproducible:
100%

Steps to Reproduce:
Please see additional info for more details.
  
Actual results:
Empty string is set for user_id
Empty string is set for correlation_id
Message properties set by c++ client can not be correctly read by other clients

Expected results:
No value is set for user_id
No value is set for correlation_id
Message properties set by c++ client can be correctly read by other clients

Additional info:

The following code demonstrates sending a message with c++, python and java client respectively and receiving these messages with the c++, python, java clients:

# qpid-config add queue q
# $cppapi/spout --content "message sent by c++ client" q
**************************
id         : 
subject    : 
user       : 
replyto    :  
correlation: 
durable    : 0
priority   : 
ttl        : 0
redeliver  : 0
props      : {spout-id:2f805cfc-c725-4502-905c-07fedda0fad2:0}
contentType: text/plain
content    : message sent by c++ client
**************************
# $pyapi/spout q "message sent by python client"
**************************
id         : None
subject    : None
user       : None
replyto    : None
correlation: None
durable    : None
priority   : None
ttl        : None
redeliver  : False
props      : {'spout-id': '4d372c5f-781f-0a45-b297-3bd6fc5239b1:0'}
contentType: None
content    : message sent by python client
**************************
Message(properties={'spout-id': '4d372c5f-781f-0a45-b297-3bd6fc5239b1:0'}, content='message sent by python client')
# java -cp $CLASSPATH org.apache.qpid.example.Spout --content "message sent by java client" q
{content=message sent by java client}

------------- Msg -------------
Body:
message sent by java client
JMS Correlation ID: null
JMS timestamp: 1316447759278
JMS expiration: 0
JMS priority: 4
JMS delivery mode: 2
JMS reply to: null
JMS Redelivered: false
JMS Destination: 'q'/None; None
JMS Type: null
JMS MessageID: ID:e855defa-f471-3f9d-b8f0-89ed7265ee05
JMS Content-Type: text/plain
AMQ message number: -1
Properties:<NONE>
-------------------------------

# $cppapi/drain -c 0 "q;{mode: browse}"
Message(properties={spout-id:2f805cfc-c725-4502-905c-07fedda0fad2:0, x-amqp-0-10.routing-key:q}, content='message sent by c++ client')
**************************
id         : 
subject    : 
user       : 
replyto    :  
correlation: 
durable    : 0
priority   : 
ttl        : 0
redeliver  : 0
props      : {spout-id:2f805cfc-c725-4502-905c-07fedda0fad2:0, x-amqp-0-10.routing-key:q}
contentType: text/plain
content    : message sent by c++ client
**************************
Message(properties={spout-id:4d372c5f-781f-0a45-b297-3bd6fc5239b1:0, x-amqp-0-10.routing-key:q}, content='message sent by python client')
**************************
id         : 
subject    : 
user       : 
replyto    :  
correlation: 
durable    : 0
priority   : 
ttl        : 0
redeliver  : 0
props      : {spout-id:4d372c5f-781f-0a45-b297-3bd6fc5239b1:0, x-amqp-0-10.routing-key:q}
contentType: 
content    : message sent by python client
**************************
Message(properties={x-amqp-0-10.content-encoding:UTF-8, x-amqp-0-10.routing-key:q}, content='message sent by java client')
**************************
id         : e855defa-f471-3f9d-b8f0-89ed7265ee05
subject    : 
user       : guest
replyto    :  
correlation: 
durable    : 1
priority   : 
ttl        : 0
redeliver  : 0
props      : {x-amqp-0-10.content-encoding:UTF-8, x-amqp-0-10.routing-key:q}
contentType: text/plain
content    : message sent by java client
**************************
# $pyapi/drain "q;{mode: browse}"
Message(user_id='', correlation_id='', properties={'x-amqp-0-10.routing-key': u'q', u'spout-id': '2f805cfc-c725-4502-905c-07fedda0fad2:0'}, content=u'message sent by c++ client')
**************************
id         : None
subject    : None
user       : 
replyto    : None
correlation: 
durable    : None
priority   : None
ttl        : None
redeliver  : False
props      : {'x-amqp-0-10.routing-key': u'q', u'spout-id': '2f805cfc-c725-4502-905c-07fedda0fad2:0'}
contentType: text/plain
content    : message sent by c++ client
**************************
Message(properties={'x-amqp-0-10.routing-key': u'q', u'spout-id': u'4d372c5f-781f-0a45-b297-3bd6fc5239b1:0'}, content='message sent by python client')
**************************
id         : None
subject    : None
user       : None
replyto    : None
correlation: None
durable    : None
priority   : None
ttl        : None
redeliver  : False
props      : {'x-amqp-0-10.routing-key': u'q', u'spout-id': u'4d372c5f-781f-0a45-b297-3bd6fc5239b1:0'}
contentType: None
content    : message sent by python client
**************************
Message(id=UUID('e855defa-f471-3f9d-b8f0-89ed7265ee05'), user_id='guest', priority=4, durable=True, properties={'x-amqp-0-10.content-encoding': u'UTF-8', 'x-amqp-0-10.routing-key': u'q'}, content=u'message sent by java client')
**************************
id         : e855defa-f471-3f9d-b8f0-89ed7265ee05
subject    : None
user       : guest
replyto    : None
correlation: None
durable    : True
priority   : 4
ttl        : None
redeliver  : False
props      : {'x-amqp-0-10.content-encoding': u'UTF-8', 'x-amqp-0-10.routing-key': u'q'}
contentType: text/plain
content    : message sent by java client
**************************
# java -cp $CLASSPATH org.apache.qpid.example.Drain "q;{mode:browse}"
{}

------------- Msg -------------
Body:
message sent by c++ client
JMS Correlation ID: 
JMS timestamp: 0
JMS expiration: 0
JMS priority: 4
JMS delivery mode: 2
JMS reply to: null
JMS Redelivered: false
JMS Destination: :///q/q?routingkey='q'
JMS Type: null
JMS MessageID: null
JMS Content-Type: text/plain
AMQ message number: 2
Properties:<NONE>
-------------------------------

------------- Msg -------------
Body:
"message sent by python client"
JMS Correlation ID: null
JMS timestamp: 0
JMS expiration: 0
JMS priority: 4
JMS delivery mode: 2
JMS reply to: null
JMS Redelivered: false
JMS Destination: :///q/q?routingkey='q'
JMS Type: null
JMS MessageID: null
JMS Content-Type: application/octet-stream
AMQ message number: 3
Properties:
	spout-id = 4d372c5f-781f-0a45-b297-3bd6fc5239b1:0

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

------------- Msg -------------
Body:
message sent by java client
JMS Correlation ID: null
JMS timestamp: 1316447759278
JMS expiration: 0
JMS priority: 4
JMS delivery mode: 2
JMS reply to: null
JMS Redelivered: false
JMS Destination: :///q/q?routingkey='q'
JMS Type: null
JMS MessageID: ID:e855defa-f471-3f9d-b8f0-89ed7265ee05
JMS Content-Type: text/plain
AMQ message number: 4
Properties:<NONE>
-------------------------------


Note You need to log in before you can comment on or make changes to this bug.