Service Broker应用程序不会在队列之间发送消息

时间:2013-02-19 10:44:17

标签: sql-server-2008 message-queue service-broker

我制作了这个Service Broker应用程序:http://pastebin.com/M1jZg2Pt

我想运行存储过程spInsertLogLine并将记录最终放在表log_line中。

我做

exec [broker].dbo.spSendLogLine
  @device_id = 'devid1',
  @application_name = 'appname1',
  @application_user_name = 'usrnme',
  @log_line_dt = 1, --@log_line_dt = GETDATE(), fails
  @log_line_message = 'this is the log line'

我最终得到队列qReceiveLogLine中的消息,状态为3,队列qInsertLogLine或表log_line中没有任何内容。

我对Service Broker很新。我做错了什么?

1 个答案:

答案 0 :(得分:2)

spSendLogLine 改变:

BEGIN DIALOG CONVERSATION @Handle
FROM SERVICE [sReceiveLogLine] 
TO SERVICE '[sInsertLogLine]'    
ON CONTRACT [cInsertLogLine]     
WITH ENCRYPTION = off;  

为:

BEGIN DIALOG CONVERSATION @Handle
FROM SERVICE [sReceiveLogLine] 
TO SERVICE 'sInsertLogLine'    
ON CONTRACT [cInsertLogLine]     
WITH ENCRYPTION = off;