Send multiple messages to service in parallel

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.

The code you posted may be for demo purposes only, but permit me to point just in case that this the fire-and-forget pattern. Read here why it is not any good:
http://rusanu.com/2006/04/06/fire-and-forget-good-for-the-military-but-not-for-service-broker-conversations/
If you want the order to be respected, I think you should send them all in the same conversation. Or else interesting thing may happen if you have multiple queue readers.
Erland Sommarskog, SQL Server MVP, [email protected]

Similar Messages

  • Sender Proxy to send multiple messages

    Hello All XI experts,
    I need your help to work for my scenario which is a Proxy-File .
    I need to send data picked up from certain group of tables via sender proxy to XI.
    The problem is that , we will be having thousands of records at the same time , so what we plan we can send the records via multiple messages in bunch of n no of messages rather sending the entire data in a single message.
    Can you please help me in order to find a way by which we can achieve this in sender proxy ( to send multiple messages with each bunch having n no of messages  ) .
    Waiting for your expert thoughts and invaluable help.
    Thanks,
    Sunil

    Hi
    This scenario can be handled at abap end.
    Decide the number of records you want to send in one file. In abap when the number of records reached then call the abap proxy method. For the remaining records again call the abap proxy method so while going to XI it will pass only the number of records desired by you.

  • Cant send multiple messages like group message

    when i try to send multiple message in my group consist of 19 persons, it won't send it just tells "try again"
    but when i try to forward a message consisting of 130 characters and up to my groups, it will send..
    can someone explain to me why can't i send my message to my group?

    Hi Skype Community,I am having the same issue on OS X 10.10.4 after getting Skype updated to version 7.10 (777). Please HELP to get this fixed. Thanks

  • Problem while sending multiple messages to JDBC

    hi
    I am trying to run a scenario file to jdbc(multiple).
    Inserting row into table with the file details and updating the same row.
    I created 2 message mapping and 2 operation mapping. One mapping to insert row and second to updated the same row.
    In ID did configuration 1 Sender Agreement, 2 Receiver Agreement ,1 Receiver Determination(Using Same system for both receiver), and 1 Interface Determination (selecting multiple operation mappings in this interface determination).
    The scenario is processing successfully in moni and channel, Problem here is only UPDATE message is going to the Database always. In both the channels UPDATE message is going. I have checked "Maintain Order at Runtime" option also its not working.
    Please help.

    HI Jabbs,
    Check help.sap.com, in receiver JDBC processing tab-> Maximum Concurrency
    Enter the number of messages to be processed in parallel by the receiver channel. For example, if you enter the value 2, then two messages are processed in parallel. Default value is 1 and this means only one message can be processed at a time by the receiver channel.
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/22/b4d13b633f7748b4d34f3191529946/frameset.htm
    also paste here the receiver structure from MONI, so as to see whether the structure is as per the required format
    Regards
    Suraj

  • Droid razr maxx keeps sending multiple messages

    My droid razr max keeps sending the same message over and over. The other day it sent the same one 20 times.  Also sometimes it sends blank messages. Is there a way to fix this?

    This problem is still persisting. In fact it is getting worse. We have called tech support multiple times. And nothing they have tried has helped. I am tired of wasting my time on the phone if it's not going to fix the problem. Something needs to be done now! This phone is a piece of garbage. You should not be allowed to screw over your customers by selling it to them. It is a nuisance to the owner of the phone and those they contact. Good thing most everyone that is texted from this phone has unlimited texting or you would be paying their bills for the ridiculous overages this would cause.

  • Problem in Sending Multiple Message by XMLSocket

    Hi, I am getting error while sending multiple XML Object by XMLSocket.
    When i send message in first time by XMLSocket then server reads fine. Otherwise from second time, server always read the first response. So where i am lagging for sending the message with different types.?

    Hi, I am getting error while sending multiple XML Object by XMLSocket.
    When i send message in first time by XMLSocket then server reads fine. Otherwise from second time, server always read the first response. So where i am lagging for sending the message with different types.?

  • Send multiple message tool

    Hi,
    Does anyone know how to send mutliple messages in PI? I have hundreds of messages which need to be resent (they were already successful) I know the way to resend successful messages now as I read up on another blog, but that only allows you to send one at a time.
    Does anyone know how to send many messages at once? Something like a mass upload tool that takes many xml messages and then sends them through the integration and adapter engine again?
    Thanks!

    Hi,
    It depends on your sender system type. If it is a SAP R/3 system and you are trying to send idocs, then there is a way.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e0bb0a9f-0980-2b10-2abb-bea522b38cb8?quicklink=index&overridelayout=true
    Regards,
    Ravi Kanth Talagana

  • Is there any example code to send a message from Service Broker to ActiveMQ?

    I would appreciate any links or discussion on this. I have found a number of similar questions but no definitive answer that it can be done. There is a .NET interface to ActiveMQ so maybe the answer is a C# CLR procedure to get this done.
    Thanks
    Tom

    Hi Thomas,
    A C# CLR procedure sounds like a fitting solution, since basically what you need is to access some program external to SQL Server.
    Note that doing so will require you to create an UNSAFE assembly within SQL Server, and probably also set the database as TRUSTWORTHY. These are serious security risks and not recommended unless there's no other choice.
    A more secure solution would be to have some .NET application that accesses your Service Broker queue (instead of an automatic reader handling procedure), and programmatically sends its contents to the ActiveMQ. This is essentially a 3rd party component
    that would need to be developed.
    I hope that helps
    Eitan Blumin; SQL Server Consultant - Madeira Data Solutions;

  • I have been sending multiple messages on this forum, but I am not getting any responses. Is there a way that I can speak to someone directly regarding my Forms Central issues?

    I would like to speak to someone directly or email technical support to get my questions answered about my Forms Central issues.

    3rd party apps have no access to the Messages app on your iPhone, therefore no. They also have no direct access to messaging functionality of your phone.

  • Mac mail says it is sending multiple messages (when only 1)

    Recently upgraded to Mavericks, updated mac mail software, emails are being sent correctly, but it always shows "sending 17 of 17" or whatever when there is only 1 being sent. I'm worried that I'm resending the email many times. Is there a fix for this?

    Yes, seeing the same. I sent an email last night, showed Sending 17 of 17. A little bug that I am sure will be ironed out in a Mavericks Update. As Thomas said, when Mail was Quit last night and reopened today, the first sent email showed 1 of 1  second one showed 2 of 2 etc. Not a virus, definately no hacking involved. I just ignore it.
    Pete

  • Nokia 3230 unable to send text messages.

    Hi,
    Please help, as iam unable to send text messages. Service center no. updated, message profile changed to text.
    Getting errory message " message sending failed" and when i click on details it showing General : memory full close some application and continue.

    i cleared all my phone mem txts and memory card too but msgs sending failed changed the sim card as well. but didn't work too! I can call with ma phone even can use internet but cant send txts
    plz reply me asap!

  • Oracle Alert sends multiple emails.

    Hi
    I've got an Alert on this table WF_LOCAL_USER_ROLES. The purpose of the alter it should fire when ever the a user is Assigned a SysAdmin Responsibility or any Updates on this responsibility the Alter work fine but it send multiple email and I've already Tick the Suppress Duplicate check box.
    Any Suggestions are welcome?
    Thanks

    Hi,
    Please see if these documents help.
    Note: 261511.1 - Alert Sends One Email Message For Each Exception
    Note:      202500.1 - Periodic Alert Sends Multiple Messages
    Regards,
    Hussein

  • Send Mutliple Messages with Socket?

    I was wondering how to send multiple messages across a socket and server using TCP with Flash. I got the writeUTFBytes and readUTFBytes working, but the messages only send one at a time.
    Here's an example from the client sending messages to the server:
    if (keys[p1_jump_key])
                    p1_up = "down";
                    sock.writeUTFBytes("p1_up_down");
                    sock.flush();
                else
                    p1_up = "up";
                    sock.writeUTFBytes("p1_up_up");
                    sock.flush();
                if (keys[p1_crouch_key])
                    p1_down = "down";
                    sock.writeUTFBytes("p1_down_down");
                    sock.flush();
                else
                    p1_down = "up";
                    sock.writeUTFBytes("p1_down_up");
                    sock.flush();
    And here's what the server does to send the message back to the client:
    var socket:Socket = event.target as Socket;
        var message:String = socket.readUTFBytes(socket.bytesAvailable);
        for each (var socket:Socket in clientSockets)
            socket.writeUTFBytes(message);
            socket.flush();
    And finally here's an example from the client reading the message from the server:
    switch (msg)
                    case "p1_down_down" :
                        p1_down = "down";
                        break;
                    case "p1_down_up" :
                        p1_down = "up";
                        break;
                    case "p1_up_down" :
                        p1_up = "down";
                        break;
                    case "p1_up_up" :
                        p1_up = "up";
                        break;
    As you can probably tell, when the messages are sending all at once, they sort of kick each other out and nothing really happens. I was wondering how I'd be able to send multiple messages at once? Thank you.

    You are not missing something here and no one here can help you. This is not an included Bluetooth profile with the iPhone at the present time anyway.
    If you purchased your iPhone within the last 14 days, you can return it for credit less a 10% restocking fee and if not, here is Apple's feedback link for the iPhone.
    http://www.apple.com/feedback/iphone.html

  • [Forum FAQ] How do I send multiple rows returned by Execute SQL Task as Email content in SQL Server Integration Services?

    Question:
    There is a scenario that users want to send multiple rows returned by Execute SQL Task as Email content to send to someone. With Execute SQL Task, the Full result set is used when the query returns multiple rows, it must map to a variable of the Object data
    type, then the return result is a rowset object, so we cannot directly send the result variable as Email content. Is there a way that we can extract the table row values that are stored in the Object variable as Email content to send to someone?
    Answer:
    To achieve this requirement, we can use a Foreach Loop container to extract the table row values that are stored in the Object variable into package variables, then use a Script Task to write the data stored in packages variables to a variable, and then set
    the variable as MessageSource in the Send Mail Task. 
    Add four variables in the package as below:
    Double-click the Execute SQL Task to open the Execute SQL Task Editor, then change the ResultSet property to “Full result set”. Assuming that the SQL Statement like below:
    SELECT   Category, CntRecords
    FROM         [table_name]
    In the Result Set pane, add a result like below (please note that we must use 0 as the result set name when the result set type is Full result set):
    Drag a Foreach Loop Container connects to the Execute SQL Task. 
    Double-click the Foreach Loop Container to open the Foreach Loop Editor, in the Collection tab, change the Enumerator to Foreach ADO Enumerator, then select User:result as ADO object source variable.
    Click the Variable Mappings pane, add two Variables as below:
    Drag a Script Task within the Foreach Loop Container.
    The C# code that can be used only in SSIS 2008 and above in Script Task as below:
    public void Main()
       // TODO: Add your code here
                Variables varCollection = null;
                string message = string.Empty;
                Dts.VariableDispenser.LockForWrite("User::Message");
                Dts.VariableDispenser.LockForWrite("User::Category");
                Dts.VariableDispenser.LockForWrite("User::CntRecords");     
                Dts.VariableDispenser.GetVariables(ref varCollection);
                //Format the query result with tab delimiters
                message = string.Format("{0}\t{1}\n",
                                            varCollection["User::Category"].Value,
                                            varCollection["User::CntRecords"].Value
               varCollection["User::Message"].Value = varCollection["User::Message"].Value + message;   
               Dts.TaskResult = (int)ScriptResults.Success;
    The VB code that can be used only in SSIS 2005 and above in Script Task as below, please note that in SSIS 2005, we should
    change PrecompileScriptIntoBinaryCode property to False and Run64BitRuntime property to False
    Public Sub Main()
            ' Add your code here
            Dim varCollection As Variables = Nothing
            Dim message As String = String.Empty
            Dts.VariableDispenser.LockForWrite("User::Message")
            Dts.VariableDispenser.LockForWrite("User::Category")
            Dts.VariableDispenser.LockForWrite("User::CntRecords")
            Dts.VariableDispenser.GetVariables(varCollection)
            'Format the query result with tab delimiters
            message = String.Format("{0}" & vbTab & "{1}" & vbLf, varCollection("User::Category").Value, varCollection("User::CntRecords").Value)
            varCollection("User::Message").Value = DirectCast(varCollection("User::Message").Value,String) + message
            Dts.TaskResult = ScriptResults.Success
    End Sub
    Drag Send Mail Task to Control Flow pane and connect it to Foreach Loop Container.
    Double-click the Send Mail Task to specify the appropriate settings, then in the Expressions tab, use the Message variable as the MessageSource Property as below:
    The final design surface like below:
    References:
    Result Sets in the Execute SQL Task
    Applies to:
    Integration Services 2005
    Integration Services 2008
    Integration Services 2008 R2
    Integration Services 2012
    Integration Services 2014
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • Service user XIISUSER  locked when resending multiple messages

    Hi All,
    Scenario: Idoc  to 2 file  receiver  (1 defined as a Business Service). We notice that occasionally when we send multiple idocs from R/3 or when we restart multiple messages from the same scenario, we will get a HTTP 401 error and will find our service user XIISUSER locked.
    i.Has anyone come across anything like this before?
    ii. In receiver determination, the "Terminate message processing with  Error(Restart Possible) radio button is chosen. Out of interest, what kind of error does this give if either 1 or the receivers cannot be found during runtime?

    Basically the error will be HTTP 401 Unauthorized and we will find XIISUSER locked. This usually happens when we send multiple idocs for the scenario or when we restart multiple messages that belongs to the scenario. By multiple i mean 5-10 messages and not a really big number.
    Once the XIISUSER is unlocked, I can just restart the message and it will be processed successfully. What I would like to know is what is causing the XIISUSER to be locked in the first place. can this be caused by the branching of the messages?

Maybe you are looking for

  • 10.4.6 Software Update Has Speeded Things Up!

    I did the software update this morning on my iBook G4. I didn't try the combo. I'm wondering if we should always update using combo to prevent potential problems. I did permissions after also. I have noticed a definite performance boost. I checked mo

  • ICloud no longer available for sharing ?

    Since the 18th I can no longer use iCloud. I get the message This is in Numbers and Pages and Keynote. I have not upgraded to iOS8 on any device or moved to iCloud drive. One of my colleagues did (move a device to iOS8) that I was sharing the file wi

  • Display flipped after installing FB 4.5

    I'm sorry to report something so deeply weird, but yesterday I installed the FB 4.5 trial and afterward my application, which is built in FB 4.0, got flipped horizontally. Here's a screenshot in case you don't believe me. I uninstalled Flash Builder

  • How to select multiple objects for left- or right-edge align?

    Hello all, This is my first day using indesign so hopefully this is an extremely basic question, but I haven't been able to find the answer anywhere online yet. Let's say you have a page full of objects and you want to align only a few of them to the

  • Porque me dice que no e comprado una canción que ya e comprado

    hace poco actualice mi ipod y me quito la canción llamada dont mine at night y la quería volver a descargar pero no me deja me dice que no la e comprado pero la compro y me dice que si lo quiero volver a descargar y luego dice que ya la tengo descarg