Commit 99147ece authored by dwentzel's avatar dwentzel

updated initiators and targets code

parent 566abfae
......@@ -50,8 +50,8 @@ select * from sys.routes WHERE name = 'TargetRoute'
--and note that there are no connections established yet from LocalService to RemoteService
select * from sys.dm_broker_connections
--HERE
--let's start a dialog but do not yet send a message.
BEGIN TRAN
DECLARE @h UNIQUEIDENTIFIER;
BEGIN DIALOG @h
FROM SERVICE [LocalService]
......@@ -60,99 +60,21 @@ BEGIN DIALOG @h
--note that there are no still no network connections established...
select * from sys.dm_broker_connections
--...but we do have a conversation endpoint established on the "source server"
select is_initiator, state_desc, far_service, far_broker_instance
from sys.conversation_endpoints
from sys.conversation_endpoints;
--now let's send a message
SEND ON CONVERSATION @h ('Success!');
COMMIT;
select * from sys.transmission_queue
SELECT tcpe.port
FROM sys.tcp_endpoints AS tcpe
INNER JOIN sys.service_broker_endpoints AS ssbe
ON ssbe.endpoint_id = tcpe.endpoint_id
WHERE ssbe.name = N'MyServiceBrokerEndpoint';
http://msdn.microsoft.com/en-us/library/ms186742.aspx
select * from sys.tcp_endpoints
select * from sys.service_broker_endpoints
select * from sys.dm_broker_connections
select * from sys.routes
IF EXISTS (
select * from sys.routes WHERE name = 'TargetRoute' AND remote_service_name = 'RemoteService'
)
select * from sys.endpoints
-- SELECT *
--FROM sys.http_endpoints;
--SELECT *
--FROM sys.soap_endpoints;
--SELECT *
--FROM sys.endpoint_webmethods;
By default, an instance of SQL Server does not contain a Service Broker endpoint. Thus, Service Broker does not send or
receive messages over the network by default. You must create a Service Broker endpoint to send or receive messages
outside the SQL Server instance.
When you create a Service Broker endpoint, SQL Server accepts TCP/IP connections on the port that is specified in the endpoint. Service Broker transport security requires authorization for connections to the port. If the computer on which SQL Server runs has a firewall enabled, the firewall configuration on the computer must allow both incoming and outgoing connections for the port that is sp
http://rusanu.com/2014/03/31/how-to-prevent-conversation-endpoint-leaks/
--now we are conversing with the "remote" service so there is a network connection
select is_initiator, state_desc, far_service, far_broker_instance
from sys.conversation_endpoints;
--this works
BEGIN TRANSACTION
DECLARE @h UNIQUEIDENTIFIER;
BEGIN DIALOG @h
FROM SERVICE [ServiceA]
TO SERVICE 'ServiceB'
WITH ENCRYPTION = OFF;
SEND ON CONVERSATION @h ('Success!');
COMMIT;
select count(*) StuckInTranQ_cnt from sys.transmission_queue
select convert(xml,message_body) as MsgBody from QueueB
--this will generate a syntax error
--BEGIN TRANSACTION
--DECLARE @h1 UNIQUEIDENTIFIER;
--BEGIN DIALOG @h1
-- FROM SERVICE [ServiceA]
-- TO SERVICE [ServiceB]
-- WITH ENCRYPTION = OFF;
--SEND ON CONVERSATION @h1 ('Syntax Error!');
--COMMIT;
--you don't need object brackets if your names are simple
BEGIN TRANSACTION
DECLARE @h2 UNIQUEIDENTIFIER;
BEGIN DIALOG @h2
FROM SERVICE ServiceA
TO SERVICE 'ServiceB', 'CURRENT DATABASE'
WITH ENCRYPTION = OFF;
SEND ON CONVERSATION @h2 ('Also Success!');
COMMIT;
select count(*) StuckInTranQ_cnt from sys.transmission_queue
select convert(xml,message_body) as MsgBody from QueueB
--basic cleanup
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment