我的系统中安装了SQL Server数据库和Activemq。我试图创建端点来监听activemq所在的端口。该港口是61617
CREATE ENDPOINT InstInitiatorEndpoint
STATE = STARTED
AS TCP ( LISTENER_PORT = 61617 )
FOR SERVICE_BROKER (AUTHENTICATION = WINDOWS );
GO
但它会导致错误:
由于以下错误,Service Broker端点无法侦听连接:'10013(尝试以其访问权限禁止的方式访问套接字。)'。
由于activemq已在同一端口上运行。我应该给不同的端口吗?如果我给出不同的端口号,那么它正在成功执行。但基本上LISTENER_PORT=61617
表示端点侦听端口61617,不是吗?任何人都可以澄清我的怀疑吗?
修改 我们假设我已经创建了端点,消息类型,合同,队列和服务,如下所示
CREATE MESSAGE TYPE RequestMessage
VALIDATION = WELL_FORMED_XML;
CREATE MESSAGE TYPE ReplyMessage
VALIDATION = WELL_FORMED_XML;
GO
CREATE CONTRACT SimpleContract
(RequestMessage
SENT BY INITIATOR,
ReplyMessage
SENT BY TARGET
);
GO
CREATE QUEUE InstInitiatorQueue;
CREATE SERVICE InitiatorService
AUTHORIZATION InitiatorUser
ON QUEUE InstInitiatorQueue;
GO
DECLARE @Cmd NVARCHAR(4000);
SET @Cmd = N'USE InstInitiatorDB;
CREATE ROUTE InstTargetRoute
WITH SERVICE_NAME =
N''TargetService'',
ADDRESS = N''TCP://localhost:61617'';';
EXEC (@Cmd);
DECLARE @Cmd NVARCHAR(4000);
SET @Cmd = N'USE msdb
CREATE ROUTE InstInitiatorRoute
WITH SERVICE_NAME =
N''InitiatorService'',
ADDRESS = N''LOCAL''';
EXEC (@Cmd);
GO
CREATE REMOTE SERVICE BINDING TargetBinding
TO SERVICE
N'TargetService'
WITH USER = TargetUser;
GO
现在我为对话创建句柄
DECLARE @InitDlgHandle UNIQUEIDENTIFIER;
DECLARE @RequestMsg NVARCHAR(100);
BEGIN TRANSACTION;
BEGIN DIALOG @InitDlgHandle
FROM SERVICE InitiatorService
TO SERVICE N'TargetService'
ON CONTRACT SimpleContract
WITH
ENCRYPTION = ON;
SELECT @RequestMsg = N'<RequestMsg>Message for Target service434.</RequestMsg>';
SEND ON CONVERSATION @InitDlgHandle
MESSAGE TYPE RequestMessage
(@RequestMsg);
SELECT @RequestMsg AS SentRequestMsg;
COMMIT TRANSACTION;
GO
此处如果您看到我尝试了两个SQL Server实例之间的对话示例,以便在SQL Server和activemq之间进行对话。我需要指定服务器到服务器的通信,因为我需要指定服务(启动器)来服务(目标)。我知道启动器服务器是sql server,但我不知道activemq的服务。我应该在数据库端的句柄对话中指定activemq的服务是什么?