Author |
Message
|
magr01 |
Posted: Mon Jul 02, 2012 9:15 pm Post subject: Error creating consumer with message selector (C++) |
|
|
Newbie
Joined: 15 Nov 2011 Posts: 6
|
Hello,
I am trying to create a consumer with a message selector (I am in a multi-threaded application and I sending a request message and only want to receive the reply intended for that request).
However, I get an error when executing this code:
producer.send(textMsg, 30000);
session.createConsumer(destination, textMsg.getJMSMessageID());
The error is XMS_E_PROTOCOL_ERROR (no further information)
Anyone has an idea what this can be??
BR
Martin |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jul 03, 2012 6:12 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Check out the samples. Looks to me that your selector is wrong. It only contains the messageID and nothing else. If you are using XMS this is wrong.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
magr01 |
Posted: Tue Jul 03, 2012 10:26 pm Post subject: |
|
|
Newbie
Joined: 15 Nov 2011 Posts: 6
|
Hi,
I am using XMS.
Changed to the code to the following instead:
string msgID = (textMsg.getJMSMessageID()).c_str();
string msgSelector = "JMSCorrelationID = " + msgID;
session.createConsumer(destination, msgSelector);
This is however making the program crash.
Cannot figure out what I am doing wrong.
Any help would be really appreciated
BR
Martin |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jul 04, 2012 6:41 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
magr01 wrote: |
Hi,
I am using XMS.
Changed to the code to the following instead:
Code: |
string msgID = (textMsg.getJMSMessageID()).c_str();
string msgSelector = "JMSCorrelationID = " + msgID;
session.createConsumer(destination, msgSelector); |
This is however making the program crash.
Cannot figure out what I am doing wrong.
Any help would be really appreciated
BR
Martin |
Try and substitute following lines
Code: |
string msgID = textMsg.getJMSMessageID();
string msgSelector = "JMSCorrelationID = '" + msgID + "'"; |
This method is already supposed to return a string... don't know what your instance method c_str() would do when operated on a string...
Note: '" single quote + string terminator
"'" string start, single quote, string terminator
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jul 04, 2012 6:47 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
fjb_saper wrote: |
magr01 wrote: |
Hi,
I am using XMS.
Changed to the code to the following instead:
Code: |
string msgID = (textMsg.getJMSMessageID()).c_str();
string msgSelector = "JMSCorrelationID = " + msgID;
session.createConsumer(destination, msgSelector); |
This is however making the program crash.
Cannot figure out what I am doing wrong.
Any help would be really appreciated
BR
Martin |
Try and substitute following lines
Code: |
string msgID = textMsg.getJMSMessageID();
string msgSelector = "JMSCorrelationID = '" + msgID + "'"; |
This method is already supposed to return a string... don't know what your instance method c_str() would do when operated on a string...
Note: '" single quote + string terminator
"'" string start, single quote, string terminator
Your msgSelector content should look like JMSCorrelationID = 'ID:af0c....00'
note that here the .... replace more of hex representation of bytes in the array...
Have fun  |
_________________ MQ & Broker admin |
|
Back to top |
|
 |
magr01 |
Posted: Wed Jul 04, 2012 11:19 pm Post subject: |
|
|
Newbie
Joined: 15 Nov 2011 Posts: 6
|
Hi,
Seems like I got it to work.
Thank you very much for your help.
BR
Martin |
|
Back to top |
|
 |
|