Skip to content

Commit 4632c73

Browse files
Update internal-activation-context.md (#34721)
* Update internal-activation-context.md Update internal-activation-context.md * Refresh Internal activation context article --------- Co-authored-by: Randolph West MSFT <[email protected]>
1 parent b4d3b03 commit 4632c73

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed
Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
11
---
22
title: Internal Activation Context
3-
description: "This topic describes the execution context for a stored procedure that is started by internal activation."
3+
description: Learn about the execution context for a stored procedure that is started by internal activation.
44
author: rwestMSFT
55
ms.author: randolphwest
66
ms.reviewer: mikeray, maghan
7-
ms.date: "03/30/2022"
7+
ms.date: 07/17/2025
88
ms.service: sql
99
ms.subservice: configuration
1010
ms.topic: conceptual
1111
---
1212

13-
# Internal Activation Context
13+
# Internal activation context
1414

1515
[!INCLUDE [sql-asdbmi](../../includes/applies-to-version/sql-asdbmi.md)]
1616

17-
This topic describes the execution context for a stored procedure that is started by internal activation.
17+
This article describes the execution context for a stored procedure that is started by internal activation.
1818

19-
## Security Context
19+
## Security context
2020

2121
A queue configured for activation must also specify the user that the activation stored procedure runs as. SQL Server impersonates this user before starting the stored procedure.
2222

2323
When the stored procedure also specifies an EXECUTE AS clause, two impersonations occur. SQL Server first impersonates the user specified for the queue and executes the stored procedure. When the stored procedure executes, the procedure impersonates the user specified in the EXECUTE AS clause of the procedure.
2424

25-
Notice that the user specified for a remote service binding is generally a different user from the user specified for activation. The permissions required for each user also differ. The remote service binding user does not need permission to read from the queue or execute stored procedures in the database, while the user specified for activation does not need permission to send messages to the service. For more information on user permissions, see [Identity and Access Control (Service Broker)](identity-and-access-control.md) and [Service Broker Dialog Security](service-broker-dialog-security.md).
25+
The user specified for a remote service binding is generally a different user from the user specified for activation. The permissions required for each user also differ. The remote service binding user doesn't need permission to read from the queue or execute stored procedures in the database, while the user specified for activation doesn't need permission to send messages to the service. For more information on user permissions, see [Identity and Access Control (Service Broker)](identity-and-access-control.md) and [Service Broker Dialog Security](service-broker-dialog-security.md).
2626

27-
## Session Settings
27+
## Session settings
2828

2929
Service Broker executes internally activated service programs on a background session distinct from the connection that created the message. The options set for this session are the default options for the database.
3030

31-
Within a session started by Service Broker, SQL Server writes the output of PRINT and RAISERROR statements to the SQL Server error log. Service Broker does not provide parameters to an activated stored procedure. Service Broker does not consider return values from an activated stored procedure and does not process result sets from an activated stored procedure.
31+
Within a session started by Service Broker, SQL Server writes the output of PRINT and RAISERROR statements to the SQL Server error log. Service Broker doesn't provide parameters to an activated stored procedure. Service Broker doesn't consider return values from an activated stored procedure and doesn't process result sets from an activated stored procedure.
3232

33-
## Transaction Context
33+
## Transaction context
3434

35-
An activated stored procedure is responsible for managing transactions. SQL Server does not start a transaction before activating the stored procedure, and the stored procedure runs in a different transaction context than the internal operation that activates the procedure. For a discussion of managing transactions in activated stored procedures, see [Transactional Messaging](transactional-messaging.md).
35+
An activated stored procedure is responsible for managing transactions. SQL Server doesn't start a transaction before activating the stored procedure, and the stored procedure runs in a different transaction context than the internal operation that activates the procedure. For a discussion of managing transactions in activated stored procedures, see [Transactional Messaging](transactional-messaging.md).
3636

37-
## Failure Detection
37+
## Failure detection
3838

39-
An activated stored procedure must receive messages from the queue that activated the procedure. If the stored procedure exits without receiving messages or the queue monitor detects that the stored procedure is not receiving messages after a short time-out, the queue monitor considers the stored procedure to have failed. In this case, the queue monitor stops activating the stored procedure.
39+
An activated stored procedure must receive messages from the queue that activated the procedure. If the stored procedure exits without receiving messages, or the queue monitor detects that the stored procedure isn't receiving messages after a short timeout, the queue monitor considers the stored procedure to have failed. In this case, the queue monitor stops activating the stored procedure.
4040

41-
## See also
41+
## Monitor
42+
43+
To check the user running the activation procedure, you can either use Extended Events (the `broker_activation` event, with `username` and `server_principal_name` actions), or the [sys.dm_broker_activated_tasks](../../relational-databases/system-dynamic-management-views/sys-dm-broker-activated-tasks-transact-sql.md) dynamic management view, which returns the database `principal_id` configured in the queue.
44+
45+
## Related content
4246

4347
- [PRINT (Transact-SQL)](../../t-sql/language-elements/print-transact-sql.md)
4448
- [RAISERROR (Transact-SQL)](../../t-sql/language-elements/raiserror-transact-sql.md)
45-
- [Implementing Internal Activation](implementing-internal-activation.md)
49+
- [Implement internal activation in Service Broker](implementing-internal-activation.md)

0 commit comments

Comments
 (0)