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 |
PhilSchmidt
Starting Member
5 Posts |
Posted - 2010-04-28 : 17:52:38
|
I just can't seem to get any messages to show up in the destination queue. I'm using SQL version 9.00.4262.00 Microsoft SQL Server Standard Edition (64-bit). The databases are on the same server. I'm going blind looking at this. Can someone please help me. Here is my code. . . .USE MASTERGO--Source DatabaseALTER DATABASE IdentityDev SET ENABLE_BROKERGO --Destination Database ALTER DATABASE IdentityServiceBrokerDev SET ENABLE_BROKER GOALTER DATABASE IdentityDev SET TRUSTWORTHY ON;GOALTER DATABASE IdentityServiceBrokerDev SET TRUSTWORTHY ON;GOUSE IdentityServiceBrokerDev;GOCREATE MESSAGE TYPE [//BothDB/Identity/RequestMessage] VALIDATION = NONE;CREATE MESSAGE TYPE [//BothDB/Identity/ReplyMessage] VALIDATION = NONE;GOCREATE CONTRACT [//BothDB/Identity/SimpleContract] ([//BothDB/Identity/RequestMessage] SENT BY INITIATOR, [//BothDB/Identity/ReplyMessage] SENT BY TARGET );GOCREATE QUEUE IdentityTargetQueue;CREATE SERVICE [//TgtDB/Identity/TargetService] ON QUEUE IdentityTargetQueue ([//BothDB/Identity/SimpleContract]);GOUSE IdentityDev;GOCREATE MESSAGE TYPE [//BothDB/Identity/RequestMessage] VALIDATION = NONE;CREATE MESSAGE TYPE [//BothDB/Identity/ReplyMessage] VALIDATION = NONE;GOCREATE CONTRACT [//BothDB/Identity/SimpleContract] ([//BothDB/Identity/RequestMessage] SENT BY INITIATOR, [//BothDB/Identity/ReplyMessage] SENT BY TARGET );GOCREATE QUEUE IdentityInitiatorQueue;CREATE SERVICE [//InitDB/Identity/InitiatorService] ON QUEUE IdentityInitiatorQueue;GO----------------------------------------------------USE IdentityDev;GODECLARE @InitDlgHandle UNIQUEIDENTIFIER;DECLARE @RequestMsg NVARCHAR(100);BEGIN TRANSACTION;BEGIN DIALOG CONVERSATION @InitDlgHandle FROM SERVICE [//InitDB/Identity/InitiatorService] TO SERVICE '//TgtDB/Identity/TargetService' ON CONTRACT [//BothDB/Identity/SimpleContract] WITH ENCRYPTION=OFF; SELECT @InitDlgHandleSELECT @RequestMsg = '<RequestMsg>Message for Target service.</RequestMsg>';SEND ON CONVERSATION @InitDlgHandle MESSAGE TYPE [//BothDB/Identity/RequestMessage] (@RequestMsg);SELECT @RequestMsg AS SentRequestMsg;COMMIT TRANSACTION;GO-----------------------------THIS IS THE PART THAT DOESN'T WORK. DOESN'T SEEM TO BE ANYTHING IN THE QUEUE.USE IdentityServiceBrokerDev;GODECLARE @RecvReqDlgHandle UNIQUEIDENTIFIER;DECLARE @RecvReqMsg NVARCHAR(100);DECLARE @RecvReqMsgName sysname;BEGIN TRANSACTION;WAITFOR( RECEIVE TOP(1) @RecvReqDlgHandle = conversation_handle, @RecvReqMsg = message_body, @RecvReqMsgName = message_type_name FROM IdentityTargetQueue), TIMEOUT 1000;SELECT @RecvReqMsg AS ReceivedRequestMsg;IF @RecvReqMsgName = '//BothDB/Identity/RequestMessage'BEGIN DECLARE @ReplyMsg NVARCHAR(100); SELECT @ReplyMsg = '<ReplyMsg>Message for Initiator service.</ReplyMsg>'; SEND ON CONVERSATION @RecvReqDlgHandle MESSAGE TYPE [//BothDB/Identity/ReplyMessage] (@ReplyMsg); END CONVERSATION @RecvReqDlgHandle;ENDSELECT @ReplyMsg AS SentReplyMsg;COMMIT TRANSACTION;GO--------------------------------------------USE IdentityDev;GODECLARE @RecvReplyMsg NVARCHAR(100);DECLARE @RecvReplyDlgHandle UNIQUEIDENTIFIER;BEGIN TRANSACTION;WAITFOR( RECEIVE TOP(1) @RecvReplyDlgHandle = conversation_handle, @RecvReplyMsg = message_body FROM IdentityInitiatorQueue), TIMEOUT 1000;END CONVERSATION @RecvReplyDlgHandle;-- Display recieved request.SELECT @RecvReplyMsg AS ReceivedReplyMsg;COMMIT TRANSACTION;GO---------------------------------------------------- |
|
Liam
Starting Member
6 Posts |
|
britneys
Starting Member
1 Post |
Posted - 2010-09-10 : 04:01:20
|
spam removed |
|
|
|
|
|