Skip to content

Commit 4a2eb1a

Browse files
Merge pull request #215168 from ggailey777/patch-8
Update snippet tags for cancellation tokens
2 parents fa29aad + 25eb8d0 commit 4a2eb1a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

articles/azure-functions/dotnet-isolated-process-guide.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,13 @@ For a more complete example of using custom middleware in your function app, see
140140

141141
A function can accept a [CancellationToken](/dotnet/api/system.threading.cancellationtoken) parameter, which enables the operating system to notify your code when the function is about to be terminated. You can use this notification to make sure the function doesn't terminate unexpectedly in a way that leaves data in an inconsistent state.
142142

143-
Cancellation tokens are supported in .NET functions when running in an isolated process. The following example shows how to use a cancellation token in a function:
143+
Cancellation tokens are supported in .NET functions when running in an isolated process. The following example raises an exception when a cancellation request has been received:
144144

145-
:::code language="csharp" source="~/azure-functions-dotnet-worker/samples/Net7Worker/HttpFunction.cs" range="23-51":::
145+
:::code language="csharp" source="~/azure-functions-dotnet-worker/samples/Net7Worker/EventHubCancellationToken.cs" id="docsnippet_cancellation_token_throw":::
146+
147+
The following example performs clean-up actions if a cancellation request has been received:
148+
149+
:::code language="csharp" source="~/azure-functions-dotnet-worker/samples/Net7Worker/EventHubCancellationToken.cs" id="docsnippet_cancellation_token_cleanup":::
146150

147151
## ReadyToRun
148152

@@ -315,7 +319,7 @@ Because your isolated process app runs outside the Functions runtime, you need t
315319
[ILogger]: /dotnet/api/microsoft.extensions.logging.ilogger
316320
[ILogger<T>]: /dotnet/api/microsoft.extensions.logging.ilogger-1
317321
[GetLogger]: /dotnet/api/microsoft.azure.functions.worker.functioncontextloggerextensions.getlogger?view=azure-dotnet&preserve-view=true
318-
[BlobClient]: /dotnet/api/azure.storage.blobs.blobclient?view=azure-dotnet
322+
[BlobClient]: /dotnet/api/azure.storage.blobs.blobclient?view=azure-dotnet&preserve-view=true
319323
[DocumentClient]: /dotnet/api/microsoft.azure.documents.client.documentclient
320324
[BrokeredMessage]: /dotnet/api/microsoft.servicebus.messaging.brokeredmessage
321325
[HttpRequestData]: /dotnet/api/microsoft.azure.functions.worker.http.httprequestdata?view=azure-dotnet&preserve-view=true

0 commit comments

Comments
 (0)