• Bobby Glover (3/25/2013)


    Fire and Forget Solution

    The solution is let the target end the conversation first. The initiator can simply send the message to the target and then continue. The target will receive the message, end the conversation from the target side and this will send an EndDialog message back to the initiator. All we have to do is attach an activated stored procedure to the initiator’s queue, and in this stored procedure we can end the initiator side of the conversation:

    How does this work if the initiator is part of a trigger. If it is changed to a SYNCHRONOUS setup. Does the trigger close after the send message is fired or does it have to wait for the full conversation cycle to complete. If so how can this be avoided in a synchronous setup.

    1. What you describe is not a fire and forget solution. You describe is a conversation where both sides end the conversation correctly.

    2. There is nothing called a synchronous service broker setup. Service broker as asynchronous, unless something changed in SQL Server 2012 that is not documentet in BOL.

    Sending a message from a trigger is no different from sending from a sproc or ad-hoc T-SQL. The execution will continue once the message has been placed in the transmission queue. It does not wait for the message to be sent to the target, nor does it wait for the target to respond. You have to handle message processing manually or by using activation procedures.