Hello,
In trying to learn SB, I have created a simple "Hello World" app as listed
below. The problem is that no matter how I've futzed with it so far,
nothing ever shows up in the "ktTestReceivingQueue". If I don't execute
the line, "end conversation @handle ;" then I see the message in the
"ktTestSendingQueue".
To read the queues I am using:
[select/receive] cast(message_body as xml), * from ktTestReceivingQueue
[select/receive] cast(message_body as xml), * from ktTestSendingQueue
Anybody see any obvious reason why the message doesn't show up in the
receiving queue?
--Set up the system
create message type ktTestMessageType
validation = well_formed_xml
create contract ktTestContract
(ktTestMessageType sent by any)
create queue ktTestSendingQueue
with status = on, retention = on
create queue ktTestReceivingQueue
with status = on, retention = on
create SERVICE ktTestSendingService
on QUEUE ktTestSendingQueue
(ktTestContract)
create SERVICE ktTestReceivingService
on QUEUE ktTestReceivingQueue
(ktTestContract)
create route ktTestRoute
with service_name = 'ktTestReceivingService',
address = 'local'
--Send a message
declare @handle uniqueidentifier;
begin dialog conversation @handle
from service [ktTestSendingService]
to service 'ktTestReceivingService', 'CURRENT DATABASE'
on contract ktTestContract
with lifetime = 600; -- seconds
send on conversation @handle
message type ktTestMessageType
('<hello>world</hello><datetime>' + convert(varchar,getdate()) +
'</datetime>');
end conversation @handle ;
Thanks,
Kevin
Remus Rusanu [MSFT] - 17 Dec 2005 01:47 GMT
The dialog you start is secure. Secure dialogs require two additional steps:
- create a database master key (see
http://msdn2.microsoft.com/en-us/library/ms174382.aspx)
- create a remote service binding for the "ktTestReceivingService" service
(see http://msdn2.microsoft.com/en-us/library/ms178024.aspx)
For you test to work, you can use a dialog w/o security, by specifying
ENCRYPTION = OFF in you BEGIN DIALOG:
begin dialog conversation @handle
from service [ktTestSendingService]
to service 'ktTestReceivingService', 'CURRENT DATABASE'
on contract ktTestContract
with encryption = off, lifetime = 600; -- seconds
For an explanation on dialog security, see
http://msdn2.microsoft.com/en-us/library/ms166036.aspx and the how-to steps
at http://msdn2.microsoft.com/en-us/library/ms166047(en-US,SQL.90).aspx
The reason you see the message in the sender's queue before the END DIALOG
statement is because you have retention on the queue. Retention kees a copy
of sent and received message for the duration of the dialog.
To investigate these kind of issues, the first step is to look in
sys.transmission_queue for the 'transmission_status'. In you case (before
using ENCRYPTION = OFF) it should say something like 'The session keys for
this conversation could not be created or accessed. The database master key
is required for this operation.'

Signature
This posting is provided "AS IS" with no warranties, and confers no rights.
HTH,
~ Remus Rusanu
SQL Service Broker
http://msdn2.microsoft.com/en-us/library/ms166043(en-US,SQL.90).aspx
> Hello,
>
[quoted text clipped - 55 lines]
>
> Kevin
Kevin Thomas - 20 Dec 2005 01:36 GMT
Yep, that did the trick.
Thanks a lot for your help,
Kevin
> The dialog you start is secure. Secure dialogs require two additional
> steps:
[quoted text clipped - 86 lines]
>>
>> Kevin