From: Steve on
Is it possible to receive something from a service Broker queue based on
what is in the message_body? For example. Say my SB Queue has 100 items.
I want to receive the item where in the message_body, there is the word
"Photo" and it's at row #50. I want to take this one out of the queue
first. All rows before that one should stay in the queue and be taken out
later.

Thanks


From: John Bell on
On Tue, 25 May 2010 11:55:20 -0400, "Steve" <Sykong(a)hotmail.com>
wrote:

>Is it possible to receive something from a service Broker queue based on
>what is in the message_body? For example. Say my SB Queue has 100 items.
>I want to receive the item where in the message_body, there is the word
>"Photo" and it's at row #50. I want to take this one out of the queue
>first. All rows before that one should stay in the queue and be taken out
>later.
>
>Thanks
>
Hi

Why don't you use a different queue and then marry them up?

John
From: Jeroen Mostert on
On 2010-05-25 17:55, Steve wrote:
> Is it possible to receive something from a service Broker queue based on
> what is in the message_body?

No. The only thing you can filter on in a receive is the conversation handle.

> For example. Say my SB Queue has 100 items. I want to receive the item
> where in the message_body, there is the word "Photo" and it's at row #50.
> I want to take this one out of the queue first. All rows before that one
> should stay in the queue and be taken out later.
>
Service Broker messages are always received in the order they were sent.
This simplification is one of the things that makes it fast in the first place.

If the word "photo" is something you know in advance, you can send the
message over a different conversation or a different queue. You can do this
with an intermediate queue and activation if inserting speed is the issue.

If you need to be able to remove arbitrary messages from the queue based on
changing criteria, Service Broker isn't appropriate. Use a regular table
that you search and delete records from. You can still use a queue as an
intermediate step to sorting (as in the previous solution). A table-based
"queue" isn't as fast as SB but can still get pretty good performance;
DELETE ... OUTPUT is your friend here.

--
J.