Service Broker

Last Post 10 Mar 2006 04:22 AM by Shafiq. 0 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Shafiq
New Member
New Member

--
10 Mar 2006 04:22 AM
Hi,

I am testing the service broker capabilities using SQL 2005., Here what i did but could not able to receive the message back. Pelase guide what I am doing wrong. Receive statement does not return any data back.

USE master;
GO

CREATE ENDPOINT BrokerEndpoint
STATE = STARTED
AS TCP ( LISTENER_PORT = 4037 )
FOR SERVICE_BROKER ( AUTHENTICATION = WINDOWS ) ;

Go
Use MySampleDB
Go
Create MESSAGE TYPE HelloMessage VALIDATION = None
GO
Create CONTRACT HelloContract ( HelloMessage SENT BY INITIATOR )
GO
Create Queue SenderQueue
GO
Create QUEUE ReceiverQueue
GO
Create Service Sender ON QUEUE SenderQueue
GO
Create Service Receiver ON QUEUE ReceiverQueue (HelloContract)
GO
DECLARE @conversationHandle UNIQUEIDENTIFIER
DECLARE @message nvarchar(100)
Begin
Begin Transaction;
Begin Dialog @conversationHandle
From Service Sender
TO Service 'Receiver'
ON CONTRACT HelloContract
Set @Message = N'Hellow, World';
Send ON Conversation @conversationHandle MESSAGE TYPE HelloMessage (@message)
Commit Transaction
End
Go

Receive Convert(Nvarchar(max),message_body) as message
From ReceiverQueue
GO
Select * from SenderQueue
Select * from ReceiverQueue
Select * from dbo.ServiceBrokerQueue
You are not authorized to post a reply.

Acceptable Use Policy