Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jhomer
Starting Member
1 Post |
Posted - 2007-02-23 : 12:28:55
|
Can someone please help with this service broker question. I'm trying to send messages on a User defined conversation group. But for some reason the group is not being persisted. Can someone tell my how to correct the problem?Here's the code...create database db1Goalter database db1 set trustworthy onGocreate database db2Gouse db1godrop service [testService];drop queue [testQueue];gouse db2drop service [targetService];drop queue [targetQueue];gouse db1Gocreate queue [testQueue];create service [testService] on queue [testQueue]; gouse db2Gocreate queue [targetQueue];create service [targetService] on queue [targetQueue] ([DEFAULT]); goUse db1Godeclare @cg uniqueidentifier;declare @h uniqueidentifier;declare @SBGuid uniqueidentifier;select @cg = '849051CA-52BC-DB11-8673-00061BDFF17D';Select @SBGuid = service_broker_guid from sys.databases where name = 'db2'begin dialog conversation @h from service [testService] to service N'targetService', @SBGuid with related_conversation_group = @cg, encryption = off;send on conversation @h;begin dialog conversation @h from service [testService] to service N'targetService', @SBGuid with related_conversation_group = @cg, encryption = off;send on conversation @h;begin dialog conversation @h from service [testService] to service N'targetService', @SBGuid with related_conversation_group = @cg, encryption = off;send on conversation @h;use db2Godeclare @cg uniqueidentifier;Set @cg = '849051CA-52BC-DB11-8673-00061BDFF17D';receive top (1) * from [targetQueue]Where conversation_group_id = @cgThe final recieve should get the first of the three messages that was sent. Running again should get the second, and again for the third.Regards |
|
|
|
|