-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
PartitionClosingEventArgs.cs
60 lines (54 loc) · 2.41 KB
/
PartitionClosingEventArgs.cs
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.Threading;
using Azure.Core;
namespace Azure.Messaging.EventHubs.Processor
{
/// <summary>
/// Contains information about the partition whose processing is being stopped.
/// </summary>
///
public class PartitionClosingEventArgs
{
/// <summary>
/// The identifier of the Event Hub partition this instance is associated with.
/// </summary>
///
public string PartitionId { get; }
/// <summary>
/// The reason why the processing for the associated partition is being stopped.
/// </summary>
///
public ProcessingStoppedReason Reason { get; }
/// <summary>
/// A <see cref="System.Threading.CancellationToken"/> to indicate that the processor is requesting that the
/// handler stop its activities. If this token is requesting cancellation, then the processor is attempting
/// to shutdown.
/// </summary>
///
/// <remarks>
/// The handler for closing has responsibility for deciding whether or not to honor
/// the cancellation request. If the application chooses not to do so, the processor will wait for the
/// handler to complete before taking further action.
/// </remarks>
///
public CancellationToken CancellationToken { get; }
/// <summary>
/// Initializes a new instance of the <see cref="PartitionClosingEventArgs"/> class.
/// </summary>
///
/// <param name="partitionId">The identifier of the Event Hub partition this instance is associated with.</param>
/// <param name="reason">The reason why the processing for the associated partition is being stopped.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
///
public PartitionClosingEventArgs(string partitionId,
ProcessingStoppedReason reason,
CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(partitionId, nameof(partitionId));
PartitionId = partitionId;
Reason = reason;
CancellationToken = cancellationToken;
}
}
}