Search code examples
sql-serverservice-brokermessage-type

Service Broker - What is EndOfStream message type?


In his SSB example about recycling conversation (http://rusanu.com/2007/05/03/recycling-conversations/), Remus Rusanu explains how to deal with DialogTimer message that results from conversation timeout trigger.

IF @messageTypeName = N'http://schemas.microsoft.com/SQL/ServiceBroker/DialogTimer'

        BEGIN

            SEND ON CONVERSATION @handle 

                MESSAGE TYPE [EndOfStream];

        END

        ELSE IF @messageTypeN...

I can't see any reference of such message type in official documentation. Is such [EndOfStream] message type a custom one and where shall it be declared (sender/receiver/both)?

Thanks a lot for explaining,


Solution

  • Is such [EndOfStream] message type a custom one and where shall it be declared (sender/receiver/both)

    [EndOfStream] is a user-defined message type as Remus mentioned in his article. To use the pattern, you'll need to create the message type using CREATE MESSAGE TYPE along with the validation options desired. The contract should specify the type is sent by the initiator (sender) since the type is used to inform the target the initiator is done sending messages.