Service Broker

  • I'm developing my first Service Broker app and was wonder what people are using message types for. I was thinking that I would use message type in the queue activation proc to branch the procedure logic. Below is an example of what I'm talking about:

    Declare @ConversationHandle as uniqueidentifier

    Declare @MessageBody as nvarchar(max)

    Declare @MessageType as sysname

    RECEIVE top (1)

    @MessageType = message_type_name,

    @ConversationHandle = conversation_handle,

    @MessageBody = message_body

    FROM TargetQueue;

    IF MessageType = 'type1' BEGIN

    ---some processing for this message type

    END

    IF MessageType = 'type2' BEGIN

    ---some processing for this message type

    END

    IF MessageType = 'type3' BEGIN

    ---some processing for this message type

    END

    Is this decent pratice?

  • I've seen it done.

    For help with your service broker implementation, search for Remus and service broker. He was able to help me a few weeks ago with my implementation.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply