Quantcast
Channel: SQL Service Broker forum
Viewing all articles
Browse latest Browse all 461

Send multiple messages to service in parallel

$
0
0

Hi all,

I have a simple piece of code that sends a single message to a service, which is then "connected" to a queue, and this queue has an associated stored procedure.

A code example:

SET @ConversationHandle = NEWID()

BEGIN DIALOG  @ConversationHandle
FROM SERVICE  [InitiatorService]
TO SERVICE    ReceiverService
WITH ENCRYPTION = OFF, LIFETIME = 3600;

SEND ON CONVERSATION @ConversationHandle
MESSAGE TYPE [DEFAULT] ('921834729384');

END CONVERSATION @ConversationHandle

So what this code does is sending the number 921834729384 into the service.

I need to execute something like this for several distinct ID's, and I don't want to send them all at a time. Currently I'm running this inside a cursor, and I'd like to find a way of sending all ID's in parallel into the queue (respecting a predefined order) but avoiding something like a cursor or a cycle.

Is there any workaround?

Thank you.


Viewing all articles
Browse latest Browse all 461

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>