forked from Avanade/Beef
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEventHubData.cs
51 lines (45 loc) · 2.53 KB
/
EventHubData.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
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/Beef
using AzureEventHubs = Microsoft.Azure.EventHubs;
using AzureConsumer = Microsoft.Azure.EventHubs.Processor;
using System;
namespace Beef.Events.EventHubs
{
/// <summary>
/// Represents the originating event data for the <see cref="EventHubConsumerHost"/>.
/// </summary>
public class EventHubData : EventSubscriberData<AzureEventHubs.EventData>
{
/// <summary>
/// Initializes a new instance of the <see cref="EventHubData"/> class.
/// </summary>
/// <param name="eventHubName">The Event Hubs name.</param>
/// <param name="consumerGroupName">The Event Hubs consumer group name.</param>
/// <param name="partitionId">The Event Hubs partition identifier.</param>
/// <param name="originating">The <see cref="EventSubscriberData{TOriginating}.Originating"/> <see cref="AzureEventHubs.EventData"/>.</param>
public EventHubData(string eventHubName, string consumerGroupName, string partitionId, AzureEventHubs.EventData originating) : base(originating)
{
EventHubName = Check.NotNull(eventHubName, nameof(eventHubName));
ConsumerGroupName = Check.NotNull(consumerGroupName, nameof(consumerGroupName));
PartitionId = Check.NotNull(partitionId, nameof(partitionId));
}
/// <summary>
/// Initializes a new instance of the <see cref="EventHubData"/> class using a <see cref="AzureConsumer.PartitionContext"/>.
/// </summary>
/// <param name="partitionContext">The <see cref="AzureConsumer.PartitionContext"/>.</param>
/// <param name="originating">The <see cref="EventSubscriberData{TOriginating}.Originating"/> <see cref="AzureEventHubs.EventData"/>.</param>
public EventHubData(AzureConsumer.PartitionContext partitionContext, AzureEventHubs.EventData originating)
: this((partitionContext ?? throw new ArgumentNullException(nameof(partitionContext))).EventHubPath, partitionContext.ConsumerGroupName, partitionContext.PartitionId, originating) { }
/// <summary>
/// Gets or sets the Event Hubs path.
/// </summary>
public string EventHubName { get; }
/// <summary>
/// Gets or sets the Event Hubs consumer group name.
/// </summary>
public string ConsumerGroupName { get; }
/// <summary>
/// Gets or sets the Event Hubs partition identifier.
/// </summary>
public string PartitionId { get; }
}
}