Class AzureEventHub<TAuthenticationToken>
An AzureBus<TAuthenticationToken> that uses Azure Service Event Hubs.
Inherited Members
Namespace: Cqrs.Azure.ServiceBus
Assembly: Cqrs.Azure.ServiceBus.dll
Syntax
public abstract class AzureEventHub<TAuthenticationToken> : AzureBus<TAuthenticationToken>
Type Parameters
Name | Description |
---|---|
TAuthenticationToken | The System.Type of the authentication token. |
Constructors
AzureEventHub(IConfigurationManager, IMessageSerialiser<TAuthenticationToken>, IAuthenticationTokenHelper<TAuthenticationToken>, ICorrelationIdHelper, ILogger, Boolean)
Instantiates a new instance of AzureEventHub<TAuthenticationToken>
Declaration
protected AzureEventHub(IConfigurationManager configurationManager, IMessageSerialiser<TAuthenticationToken> messageSerialiser, IAuthenticationTokenHelper<TAuthenticationToken> authenticationTokenHelper, ICorrelationIdHelper correlationIdHelper, ILogger logger, bool isAPublisher)
Parameters
Type | Name | Description |
---|---|---|
IConfigurationManager | configurationManager | |
IMessageSerialiser<TAuthenticationToken> | messageSerialiser | |
IAuthenticationTokenHelper<TAuthenticationToken> | authenticationTokenHelper | |
cdmdotnet.Logging.ICorrelationIdHelper | correlationIdHelper | |
cdmdotnet.Logging.ILogger | logger | |
System.Boolean | isAPublisher |
Fields
DefaultPrivateEventHubConsumerGroupName
The default name of the consumer group in the private event hub if no IConfigurationManager value is set.
Declaration
protected const string DefaultPrivateEventHubConsumerGroupName = "$Default"
Field Value
Type | Description |
---|---|
System.String |
DefaultPublicEventHubConsumerGroupName
The default name of the consumer group in the public event hub if no IConfigurationManager value is set.
Declaration
protected const string DefaultPublicEventHubConsumerGroupName = "$Default"
Field Value
Type | Description |
---|---|
System.String |
Properties
DefaultPrivateEventHubName
The default name of the private event hub if no IConfigurationManager value is set.
Declaration
protected abstract string DefaultPrivateEventHubName { get; }
Property Value
Type | Description |
---|---|
System.String |
DefaultPublicEventHubName
The default name of the public event hub if no IConfigurationManager value is set.
Declaration
protected abstract string DefaultPublicEventHubName { get; }
Property Value
Type | Description |
---|---|
System.String |
EventHubConnectionStringNameConfigurationKey
The configuration key for the event hub connection string as used by IConfigurationManager.
Declaration
protected abstract string EventHubConnectionStringNameConfigurationKey { get; }
Property Value
Type | Description |
---|---|
System.String |
EventHubPublisher
Gets the publicMicrosoft.ServiceBus.Messaging.EventHubClient.
Declaration
protected EventHubClient EventHubPublisher { get; }
Property Value
Type | Description |
---|---|
Microsoft.ServiceBus.Messaging.EventHubClient |
EventHubReceiver
Gets the publicMicrosoft.ServiceBus.Messaging.EventProcessorHost.
Declaration
protected EventProcessorHost EventHubReceiver { get; }
Property Value
Type | Description |
---|---|
Microsoft.ServiceBus.Messaging.EventProcessorHost |
EventHubStorageConnectionStringNameConfigurationKey
The configuration key for the event hub storage connection string as used by IConfigurationManager.
Declaration
protected abstract string EventHubStorageConnectionStringNameConfigurationKey { get; }
Property Value
Type | Description |
---|---|
System.String |
PrivateEventHubConsumerGroupName
The name of the consumer group in the private event hub.
Declaration
protected string PrivateEventHubConsumerGroupName { get; }
Property Value
Type | Description |
---|---|
System.String |
PrivateEventHubConsumerGroupNameConfigurationKey
The configuration key for the name of the consumer group name of the private event hub as used by IConfigurationManager.
Declaration
protected abstract string PrivateEventHubConsumerGroupNameConfigurationKey { get; }
Property Value
Type | Description |
---|---|
System.String |
PrivateEventHubName
The name of the private event hub.
Declaration
protected string PrivateEventHubName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PrivateEventHubNameConfigurationKey
The configuration key for the name of the private event hub as used by IConfigurationManager.
Declaration
protected abstract string PrivateEventHubNameConfigurationKey { get; }
Property Value
Type | Description |
---|---|
System.String |
PublicEventHubConsumerGroupName
The name of the consumer group in the public event hub.
Declaration
protected string PublicEventHubConsumerGroupName { get; }
Property Value
Type | Description |
---|---|
System.String |
PublicEventHubConsumerGroupNameConfigurationKey
The configuration key for the name of the consumer group name of the public event hub as used by IConfigurationManager.
Declaration
protected abstract string PublicEventHubConsumerGroupNameConfigurationKey { get; }
Property Value
Type | Description |
---|---|
System.String |
PublicEventHubName
The name of the public event hub.
Declaration
protected string PublicEventHubName { get; }
Property Value
Type | Description |
---|---|
System.String |
PublicEventHubNameConfigurationKey
The configuration key for the name of the public event hub as used by IConfigurationManager.
Declaration
protected abstract string PublicEventHubNameConfigurationKey { get; }
Property Value
Type | Description |
---|---|
System.String |
ReceiverMessageHandler
The System.Action<T1, T2> used for Microsoft.ServiceBus.Messaging.EventProcessorHost.RegisterEventProcessorFactoryAsync(Microsoft.ServiceBus.Messaging.IEventProcessorFactory) on EventHubReceiver.
Declaration
protected Action<PartitionContext, EventData> ReceiverMessageHandler { get; }
Property Value
Type | Description |
---|---|
System.Action<Microsoft.ServiceBus.Messaging.PartitionContext, Microsoft.ServiceBus.Messaging.EventData> |
ReceiverMessageHandlerOptions
The Microsoft.ServiceBus.Messaging.EventProcessorOptions used for Microsoft.ServiceBus.Messaging.EventProcessorHost.RegisterEventProcessorFactoryAsync(Microsoft.ServiceBus.Messaging.IEventProcessorFactory) on EventHubReceiver.
Declaration
protected EventProcessorOptions ReceiverMessageHandlerOptions { get; }
Property Value
Type | Description |
---|---|
Microsoft.ServiceBus.Messaging.EventProcessorOptions |
StorageConnectionString
The event hub storage connection string.
Declaration
protected string StorageConnectionString { get; }
Property Value
Type | Description |
---|---|
System.String |
TelemetryHelper
Gets the cdmdotnet.Logging.ITelemetryHelper.
Declaration
protected ITelemetryHelper TelemetryHelper { get; set; }
Property Value
Type | Description |
---|---|
cdmdotnet.Logging.ITelemetryHelper |
Methods
ApplyReceiverMessageHandler()
Applies the stored ReceiverMessageHandler and ReceiverMessageHandlerOptions to the EventHubReceiver.
Declaration
protected override void ApplyReceiverMessageHandler()
Overrides
CheckHubExists(NamespaceManager, String, String)
Checks if a event hub by the provided hubName
exists and
Checks if a consumer group by the provided consumerGroupNames
exists.
Declaration
protected virtual void CheckHubExists(NamespaceManager namespaceManager, string hubName, string consumerGroupNames)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.ServiceBus.NamespaceManager | namespaceManager | |
System.String | hubName | |
System.String | consumerGroupNames |
CheckPrivateHubExists(NamespaceManager)
Checks if the private hub and consumer group name exists as per PrivateEventHubName and PrivateEventHubConsumerGroupName.
Declaration
protected virtual void CheckPrivateHubExists(NamespaceManager namespaceManager)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.ServiceBus.NamespaceManager | namespaceManager | The Microsoft.ServiceBus.NamespaceManager. |
CheckPublicHubExists(NamespaceManager)
Checks if the public hub and consumer group name exists as per PublicEventHubName and PublicEventHubConsumerGroupName.
Declaration
protected virtual void CheckPublicHubExists(NamespaceManager namespaceManager)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.ServiceBus.NamespaceManager | namespaceManager | The Microsoft.ServiceBus.NamespaceManager. |
GetConnectionString()
Gets the connection string for the bus from ConfigurationManager
Declaration
protected override string GetConnectionString()
Returns
Type | Description |
---|---|
System.String |
Overrides
InstantiatePublishing()
Instantiate publishing on this bus by calling CheckPrivateHubExists(NamespaceManager) and CheckPublicHubExists(NamespaceManager) then calling StartSettingsChecking()
Declaration
protected override void InstantiatePublishing()
Overrides
InstantiateReceiving()
Instantiate receiving on this bus by calling CheckPrivateHubExists(NamespaceManager) and CheckPublicHubExists(NamespaceManager) then InstantiateReceiving for private and public topics, then calling StartSettingsChecking()
Declaration
protected override void InstantiateReceiving()
Overrides
RegisterReceiverMessageHandler(Action<PartitionContext, EventData>, EventProcessorOptions)
Registers the provided receiverMessageHandler
with the provided receiverMessageHandlerOptions
.
Declaration
protected virtual void RegisterReceiverMessageHandler(Action<PartitionContext, EventData> receiverMessageHandler, EventProcessorOptions receiverMessageHandlerOptions = null)
Parameters
Type | Name | Description |
---|---|---|
System.Action<Microsoft.ServiceBus.Messaging.PartitionContext, Microsoft.ServiceBus.Messaging.EventData> | receiverMessageHandler | |
Microsoft.ServiceBus.Messaging.EventProcessorOptions | receiverMessageHandlerOptions |
SetConnectionStrings()
Calls SetConnectionStrings() and then sets the required storage connection string.
Declaration
protected override void SetConnectionStrings()
Overrides
StoreReceiverMessageHandler(Action<PartitionContext, EventData>, EventProcessorOptions)
Stores the provided receiverMessageHandler
and receiverMessageHandlerOptions
.
Declaration
protected virtual void StoreReceiverMessageHandler(Action<PartitionContext, EventData> receiverMessageHandler, EventProcessorOptions receiverMessageHandlerOptions = null)
Parameters
Type | Name | Description |
---|---|---|
System.Action<Microsoft.ServiceBus.Messaging.PartitionContext, Microsoft.ServiceBus.Messaging.EventData> | receiverMessageHandler | |
Microsoft.ServiceBus.Messaging.EventProcessorOptions | receiverMessageHandlerOptions |
TriggerSettingsChecking()
Triggers settings checking on EventHubPublisher and EventHubReceiver, then calls InstantiateReceiving() and InstantiatePublishing().
Declaration
protected override void TriggerSettingsChecking()
Overrides
ValidateSettingsHaveChanged()
Checks ValidateSettingsHaveChanged() and that StorageConnectionString have changed.
Declaration
protected override bool ValidateSettingsHaveChanged()
Returns
Type | Description |
---|---|
System.Boolean |