| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System.Threading; |
| | 5 | | using Azure.Core; |
| | 6 | |
|
| | 7 | | namespace Azure.Messaging.EventHubs.Processor |
| | 8 | | { |
| | 9 | | /// <summary> |
| | 10 | | /// Contains information about the partition whose processing is being stopped. |
| | 11 | | /// </summary> |
| | 12 | | /// |
| | 13 | | public class PartitionClosingEventArgs |
| | 14 | | { |
| | 15 | | /// <summary> |
| | 16 | | /// The identifier of the Event Hub partition this instance is associated with. |
| | 17 | | /// </summary> |
| | 18 | | /// |
| 0 | 19 | | public string PartitionId { get; } |
| | 20 | |
|
| | 21 | | /// <summary> |
| | 22 | | /// The reason why the processing for the associated partition is being stopped. |
| | 23 | | /// </summary> |
| | 24 | | /// |
| 0 | 25 | | public ProcessingStoppedReason Reason { get; } |
| | 26 | |
|
| | 27 | | /// <summary> |
| | 28 | | /// A <see cref="CancellationToken"/> instance to signal the request to cancel the operation. |
| | 29 | | /// </summary> |
| | 30 | | /// |
| 0 | 31 | | public CancellationToken CancellationToken { get; } |
| | 32 | |
|
| | 33 | | /// <summary> |
| | 34 | | /// Initializes a new instance of the <see cref="PartitionClosingEventArgs"/> class. |
| | 35 | | /// </summary> |
| | 36 | | /// |
| | 37 | | /// <param name="partitionId">The identifier of the Event Hub partition this instance is associated with.</param |
| | 38 | | /// <param name="reason">The reason why the processing for the associated partition is being stopped.</param> |
| | 39 | | /// <param name="cancellationToken">A <see cref="CancellationToken"/> instance to signal the request to cancel t |
| | 40 | | /// |
| 0 | 41 | | public PartitionClosingEventArgs(string partitionId, |
| 0 | 42 | | ProcessingStoppedReason reason, |
| 0 | 43 | | CancellationToken cancellationToken = default) |
| | 44 | | { |
| 0 | 45 | | Argument.AssertNotNullOrEmpty(partitionId, nameof(partitionId)); |
| | 46 | |
|
| 0 | 47 | | PartitionId = partitionId; |
| 0 | 48 | | Reason = reason; |
| 0 | 49 | | CancellationToken = cancellationToken; |
| 0 | 50 | | } |
| | 51 | | } |
| | 52 | | } |