I have Service A which sends a message to Service B when a update/delete/insert trigger fires. Service B dequeing logic looks like:
declare @messagebody xml declare @messagetype nvarchar(256) declare @cg uniqueidentifier declare @ch uniqueidentifier DECLARE @messages TABLE(messagetype nvarchar(256),messagebody xml) begin try begin transaction; waitfor ( receive top (1) @cg = conversation_group_id, @ch = conversation_handle, @messagetype = message_type_name, @messagebody = cast(message_body as xml) from MyPolicyQueue ),TIMEOUT @receiveTimeoutMs if @messagebody is not null begin insert into @messages values (@messagetype, @messagebody) end select * from @messages end conversation @ch commit end try
ServiceB will end the conversation but afterwards, the queue now has an EndDialog message that never gets processed.
The intent is asynchronous handling of update messages with the trigger used as the event source. Service B closes the conversation but trigger does not (It would probably be a very bad thing if trigger blocked waiting for EndDialog message response). How do you handle the EndDialog message in this scenario?
The code is based on this example.
scott