| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System.Threading; |
| | 5 | | using Azure.Core; |
| | 6 | | using Azure.Messaging.EventHubs.Consumer; |
| | 7 | |
|
| | 8 | | namespace Azure.Messaging.EventHubs.Processor |
| | 9 | | { |
| | 10 | | /// <summary> |
| | 11 | | /// Contains information about a partition that an <c>EventProcessorClient</c> will be |
| | 12 | | /// processing events from. It can also be used to specify the position within a partition |
| | 13 | | /// where the associated <c>EventProcessorClient</c> should begin reading events in case |
| | 14 | | /// it cannot find a checkpoint. |
| | 15 | | /// </summary> |
| | 16 | | /// |
| | 17 | | /// <seealso href="https://www.nuget.org/packages/Azure.Messaging.EventHubs.Processor" /> |
| | 18 | | /// |
| | 19 | | public class PartitionInitializingEventArgs |
| | 20 | | { |
| | 21 | | /// <summary> |
| | 22 | | /// The identifier of the partition whose processing is starting. |
| | 23 | | /// </summary> |
| | 24 | | /// |
| 0 | 25 | | public string PartitionId { get; } |
| | 26 | |
|
| | 27 | | /// <summary> |
| | 28 | | /// The position within a partition where the associated <c>EventProcessorClient</c> should |
| | 29 | | /// begin reading events when no checkpoint can be found. |
| | 30 | | /// </summary> |
| | 31 | | /// |
| 0 | 32 | | public EventPosition DefaultStartingPosition { get; set; } |
| | 33 | |
|
| | 34 | | /// <summary> |
| | 35 | | /// A <see cref="CancellationToken"/> instance to signal the request to cancel the operation. |
| | 36 | | /// </summary> |
| | 37 | | /// |
| 0 | 38 | | public CancellationToken CancellationToken { get; } |
| | 39 | |
|
| | 40 | | /// <summary> |
| | 41 | | /// Initializes a new instance of the <see cref="PartitionInitializingEventArgs"/> class. |
| | 42 | | /// </summary> |
| | 43 | | /// |
| | 44 | | /// <param name="partitionId">The identifier of the partition whose processing is starting.</param> |
| | 45 | | /// <param name="defaultStartingPosition">The position within a partition where the associated <c>EventProcessor |
| | 46 | | /// <param name="cancellationToken">A <see cref="CancellationToken"/> instance to signal the request to cancel t |
| | 47 | | /// |
| 0 | 48 | | public PartitionInitializingEventArgs(string partitionId, |
| 0 | 49 | | EventPosition defaultStartingPosition, |
| 0 | 50 | | CancellationToken cancellationToken = default) |
| | 51 | | { |
| 0 | 52 | | Argument.AssertNotNullOrEmpty(partitionId, nameof(partitionId)); |
| | 53 | |
|
| 0 | 54 | | PartitionId = partitionId; |
| 0 | 55 | | DefaultStartingPosition = defaultStartingPosition; |
| 0 | 56 | | CancellationToken = cancellationToken; |
| 0 | 57 | | } |
| | 58 | | } |
| | 59 | | } |