You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Todd Herman <to...@apx-labs.com> on 2012/03/08 17:47:52 UTC

How to receive specific response

I am using the Qpid C++ client.  Well, technically I am writing this in C# so I am using the .net bindings for the c++ client.  I need to retrieve a specific message from a queue.  Basically, multiple clients will watch a certain queue for responses but they each only want there (based on the correlation id) message.  It looks like you can do this with the Java client because CreateConsumer allows you to provide a "message selector", which I assume allows you to filter the messages to just the one you want.

So, how do I do the equivalent when using the c++ (and .net binding) client?  I could grab each message and check the correlation id but won't doing that remove it from the queue?  I need to make sure I don't remove the wrong one from the queue.

[Description: Description: Description: C099A092-D672-44AE-BE50-B9C847BC176F]

Todd Herman
Senior Software Engineer

APX Labs
2350 Corporate Park Drive, Ste. 510 | Herndon, VA 20171
m: 703-489-8761 | www.apx-labs.com<http://www.apx-labs.com/> | @APXLabs




RE: How to receive specific response

Posted by Todd Herman <to...@apx-labs.com>.
The whole filtering thing is what I am trying to figure out.  I just can't add or alter the queues in anyway because I have no authority to do so.  I will have to experiment a little.  Thanks.

Todd

-----Original Message-----
From: Steve Huston [mailto:shuston@riverace.com] 
Sent: Monday, March 12, 2012 10:59 AM
To: users@qpid.apache.org
Subject: RE: How to receive specific response

Hi Todd,

I suggest finding a way to filter the messages into queues private to each receiver so you don't need to fetch, examine, release each one.

That said, you can qpid::messaging::session::release() a message if you don't want it - the broker will redeliver it. I'm not completely sure if it may redelivered to the same client, but it's worth a try.

To keep the message, acknowledge it.

-Steve


> -----Original Message-----
> From: Todd Herman [mailto:todd@apx-labs.com]
> Sent: Monday, March 12, 2012 10:21 AM
> To: users@qpid.apache.org
> Subject: FW: How to receive specific response
> 
> I send this question out earlier but didn't get any response so I
figured I
> would send it again.  The main thing I am trying to see is how to read 
> a message from a queue without it being automatically deleted.  I have 
> no control over how the queue was created.  I need to be able to check 
> all
the
> messages on the queue because only certain ones will be for me.  I 
> can't have the messages not for me being deleted because I read them.
> 
> Any thoughts?
> 
> From: Todd Herman [mailto:todd@apx-labs.com]
> Sent: Thursday, March 08, 2012 11:48 AM
> To: users@qpid.apache.org
> Subject: How to receive specific response
> 
> I am using the Qpid C++ client.  Well, technically I am writing this 
> in
C# so I am
> using the .net bindings for the c++ client.  I need to retrieve a
specific
> message from a queue.  Basically, multiple clients will watch a 
> certain
queue
> for responses but they each only want there (based on the correlation
id)
> message.  It looks like you can do this with the Java client because 
> CreateConsumer allows you to provide a "message selector", which I
assume
> allows you to filter the messages to just the one you want.
> 
> So, how do I do the equivalent when using the c++ (and .net binding)
client?
> I could grab each message and check the correlation id but won't doing
that
> remove it from the queue?  I need to make sure I don't remove the 
> wrong one from the queue.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org For additional commands, e-mail: users-help@qpid.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


RE: How to receive specific response

Posted by Steve Huston <sh...@riverace.com>.
Hi Todd,

I suggest finding a way to filter the messages into queues private to each
receiver so you don't need to fetch, examine, release each one.

That said, you can qpid::messaging::session::release() a message if you
don't want it - the broker will redeliver it. I'm not completely sure if
it may redelivered to the same client, but it's worth a try.

To keep the message, acknowledge it.

-Steve


> -----Original Message-----
> From: Todd Herman [mailto:todd@apx-labs.com]
> Sent: Monday, March 12, 2012 10:21 AM
> To: users@qpid.apache.org
> Subject: FW: How to receive specific response
> 
> I send this question out earlier but didn't get any response so I
figured I
> would send it again.  The main thing I am trying to see is how to read a
> message from a queue without it being automatically deleted.  I have no
> control over how the queue was created.  I need to be able to check all
the
> messages on the queue because only certain ones will be for me.  I can't
> have the messages not for me being deleted because I read them.
> 
> Any thoughts?
> 
> From: Todd Herman [mailto:todd@apx-labs.com]
> Sent: Thursday, March 08, 2012 11:48 AM
> To: users@qpid.apache.org
> Subject: How to receive specific response
> 
> I am using the Qpid C++ client.  Well, technically I am writing this in
C# so I am
> using the .net bindings for the c++ client.  I need to retrieve a
specific
> message from a queue.  Basically, multiple clients will watch a certain
queue
> for responses but they each only want there (based on the correlation
id)
> message.  It looks like you can do this with the Java client because
> CreateConsumer allows you to provide a "message selector", which I
assume
> allows you to filter the messages to just the one you want.
> 
> So, how do I do the equivalent when using the c++ (and .net binding)
client?
> I could grab each message and check the correlation id but won't doing
that
> remove it from the queue?  I need to make sure I don't remove the wrong
> one from the queue.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to receive specific response

Posted by Pavel Moravec <pm...@redhat.com>.
Hi Todd,
if you wish to non-destructively read messages in a queue, you can use browse mode, i.e. address string would be something like:

"queue-name; {mode:browse}"

If your question is extended by ".. and how to consume the message I am interested in (and no other)", then I don't know if it is possible with C++ broker (Java broker has message selectors that I am not familiar with).

Kind regards,
Pavel


----- Original Message -----
> From: "Todd Herman" <to...@apx-labs.com>
> To: users@qpid.apache.org
> Sent: Monday, March 12, 2012 3:20:34 PM
> Subject: FW: How to receive specific response
> 
> I send this question out earlier but didn't get any response so I
> figured I would send it again.  The main thing I am trying to see is
> how to read a message from a queue without it being automatically
> deleted.  I have no control over how the queue was created.  I need
> to be able to check all the messages on the queue because only
> certain ones will be for me.  I can't have the messages not for me
> being deleted because I read them.
> 
> Any thoughts?
> 
> From: Todd Herman [mailto:todd@apx-labs.com]
> Sent: Thursday, March 08, 2012 11:48 AM
> To: users@qpid.apache.org
> Subject: How to receive specific response
> 
> I am using the Qpid C++ client.  Well, technically I am writing this
> in C# so I am using the .net bindings for the c++ client.  I need to
> retrieve a specific message from a queue.  Basically, multiple
> clients will watch a certain queue for responses but they each only
> want there (based on the correlation id) message.  It looks like you
> can do this with the Java client because CreateConsumer allows you
> to provide a "message selector", which I assume allows you to filter
> the messages to just the one you want.
> 
> So, how do I do the equivalent when using the c++ (and .net binding)
> client?  I could grab each message and check the correlation id but
> won't doing that remove it from the queue?  I need to make sure I
> don't remove the wrong one from the queue.
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


FW: How to receive specific response

Posted by Todd Herman <to...@apx-labs.com>.
I send this question out earlier but didn't get any response so I figured I would send it again.  The main thing I am trying to see is how to read a message from a queue without it being automatically deleted.  I have no control over how the queue was created.  I need to be able to check all the messages on the queue because only certain ones will be for me.  I can't have the messages not for me being deleted because I read them.

Any thoughts?

From: Todd Herman [mailto:todd@apx-labs.com]
Sent: Thursday, March 08, 2012 11:48 AM
To: users@qpid.apache.org
Subject: How to receive specific response

I am using the Qpid C++ client.  Well, technically I am writing this in C# so I am using the .net bindings for the c++ client.  I need to retrieve a specific message from a queue.  Basically, multiple clients will watch a certain queue for responses but they each only want there (based on the correlation id) message.  It looks like you can do this with the Java client because CreateConsumer allows you to provide a "message selector", which I assume allows you to filter the messages to just the one you want.

So, how do I do the equivalent when using the c++ (and .net binding) client?  I could grab each message and check the correlation id but won't doing that remove it from the queue?  I need to make sure I don't remove the wrong one from the queue.