Move conversation error
I’m trying to move a service broker conversation to another group conversation.
The code is:
declare @handle uniqueidentifier; declare @conversationGroup uniqueidentifier; begin dialog conversation @handle from service ConsolidatorService to service 'ConsolidatorTargetService' on contract [//Gereon/Consolidator/ConsolidatorContract] with encryption = off; get conversation group @conversationGroup from [ConsolidatorTargetQueue]; if(@conversationGroup is not null) move conversation @handle to @conversationGroup; send on conversation @handle message type [//Gereon/Consolidator/GeBasicChangesMessage] (@MessageBody);
But SQL Server returns me the error
The destination conversation group ’60EEBC15-E75E-E611-80CC-00155D090304′ is invalid.
I can’t understand why the group_conversation_id returned by get conversation is not valid.
One Solution collect form web for “Move conversation error”
You are trying to move the initiator handle to a group on the target service. Moving conversations can only succeed within the same service and queue.
Your question is a common issue with attempting to achieve grouping of conversations on the receiving end. There are two alternatives patterns to achieve what you want:
- you can move the conversation on target, after you RECEIVE the first message. This implies you have a method to distinguish first message from the subsequent ones, the conversation will not be grouped for the first message received, and is prone to deadlocks due to conversation group locking between concurrent receivers. Due to these problems, I do not recommend this pattern.
- you can reverse the dialog direction. Instead of beginning the conversation from
ConsolidatorTargetService, start the dialog from
ConsolidatorServiceand specify the desired group in the
BEGIN CONVERSATIONitself. Then send a message from target to initiator. RECEIVE this message on the initiator and then use this initiator received handle for subsequent sends from
ConsolidatorService. This makes sense only if you intend to send many messages. This pattern works, but is a bit tricky to implement correctly.
Now, the $1M question: why do you want to group the conversations on the target? There are valid uses for this, but I would like to hear your reasoning.