-
Notifications
You must be signed in to change notification settings - Fork 0
/
24_receive_reply.sql
35 lines (27 loc) · 1020 Bytes
/
24_receive_reply.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/****************************************************************************
- Receive the reply, end conversation from this side too
****************************************************************************/
use ServiceBrokerBeginner
go
declare @handle uniqueidentifier
declare @message_body nvarchar(1000)
declare @message_type_name sysname
begin transaction;
/* receive reply from request queue */
receive top(1)
@handle = conversation_Handle
,@message_body = cast(message_body as nvarchar(max))
,@message_type_name = message_type_name
from [dbo].[InitiatorQueue];
/* check if we received the expected message type */
if @message_type_name = N'ReplyMessage'
end conversation @handle;
/* show received message in result window */
select @message_body as MessageReceived;
commit transaction;
go
/*
check queues again: everything should be in the clear now
as far as endpointsgo there might be an endpoint left with security timestamp
half an hour in the future (UTC), which is ok
*/