none
BEGIN CONVERSATION TIMER

    Question

  • I'm using a timer to call the procedure after 15 minutes.

    DECLARE @DialogHandle UNIQUEIDENTIFIER;
    BEGIN dialog CONVERSATION @DialogHandle FROM SERVICE [myService] TO SERVICE N'myService', 'current database' WITH ENCRYPTION = OFF;
    BEGIN CONVERSATION TIMER(@DialogHandle) TIMEOUT = 900;
    When message arrives in queue it activates stored procedure. It works.

    This is from MSDN:

    Starts a timer. When the time-out expires, Service Broker puts a message of type http://schemas.microsoft.com/SQL/ServiceBroker/DialogTimer on the local queue for the conversation.

    What i would like to do is to add some custom message (or activate procedure with some parameter value).
    If i try to create message and sends it, it won't work:

    DECLARE @RequestMessage XML;
    SET @RequestMessage = N'<Request><SA>58</SA></Request>';
    BEGIN dialog CONVERSATION @DialogHandle FROM SERVICE [myService] TO SERVICE N'myService', 'current database' WITH ENCRYPTION = OFF;
    BEGIN CONVERSATION TIMER(@DialogHandle(@RequestMessage)) TIMEOUT =900;

    Is there some other way to get some values when my procedure is activated?
    I can insert dialogHandle and some values into some table when starting timer and when procedure is activated read this values from table but I guess there should be some more simplify way?

    br, Simon

    Tuesday, July 22, 2014 9:52 AM