Class AzureServiceBus<TAuthenticationToken>
An AzureBus<TAuthenticationToken> that uses Azure Service Bus.
Inherited Members
Namespace: Cqrs.Azure.ServiceBus
Assembly: Cqrs.Azure.ServiceBus.dll
Syntax
public abstract class AzureServiceBus<TAuthenticationToken> : AzureBus<TAuthenticationToken>
Type Parameters
Name | Description |
---|---|
TAuthenticationToken | The |
Constructors
AzureServiceBus(IConfigurationManager, IMessageSerialiser<TAuthenticationToken>, IAuthenticationTokenHelper<TAuthenticationToken>, ICorrelationIdHelper, ILogger, IAzureBusHelper<TAuthenticationToken>, IBusHelper, Boolean)
Instantiates a new instance of AzureServiceBus<TAuthenticationToken>
Declaration
protected AzureServiceBus(IConfigurationManager configurationManager, IMessageSerialiser<TAuthenticationToken> messageSerialiser, IAuthenticationTokenHelper<TAuthenticationToken> authenticationTokenHelper, ICorrelationIdHelper correlationIdHelper, ILogger logger, IAzureBusHelper<TAuthenticationToken> azureBusHelper, IBusHelper busHelper, bool isAPublisher)
Parameters
Type | Name | Description |
---|---|---|
IConfigurationManager | configurationManager | |
IMessageSerialiser<TAuthenticationToken> | messageSerialiser | |
IAuthenticationTokenHelper<TAuthenticationToken> | authenticationTokenHelper | |
ICorrelationIdHelper | correlationIdHelper | |
ILogger | logger | |
IAzureBusHelper<TAuthenticationToken> | azureBusHelper | |
IBusHelper | busHelper | |
System.Boolean | isAPublisher |
Fields
DefaultPrivateTopicSubscriptionName
The default name of the subscription in the private topic if no IConfigurationManager value is set.
Declaration
protected const string DefaultPrivateTopicSubscriptionName = null
Field Value
Type | Description |
---|---|
System.String |
DefaultPublicTopicSubscriptionName
The default name of the subscription in the public topic if no IConfigurationManager value is set.
Declaration
protected const string DefaultPublicTopicSubscriptionName = null
Field Value
Type | Description |
---|---|
System.String |
Properties
AzureBusHelper
Gets the IAzureBusHelper<TAuthenticationToken>.
Declaration
protected IAzureBusHelper<TAuthenticationToken> AzureBusHelper { get; }
Property Value
Type | Description |
---|---|
IAzureBusHelper<TAuthenticationToken> |
BusHelper
Gets the IBusHelper.
Declaration
protected IBusHelper BusHelper { get; }
Property Value
Type | Description |
---|---|
IBusHelper |
DefaultPrivateTopicName
The default name of the private topic if no IConfigurationManager value is set.
Declaration
protected abstract string DefaultPrivateTopicName { get; }
Property Value
Type | Description |
---|---|
System.String |
DefaultPublicTopicName
The default name of the public topic if no IConfigurationManager value is set.
Declaration
protected abstract string DefaultPublicTopicName { get; }
Property Value
Type | Description |
---|---|
System.String |
MessageBusConnectionStringConfigurationKey
The configuration key for the message bus connection string as used by IConfigurationManager.
Declaration
protected abstract string MessageBusConnectionStringConfigurationKey { get; }
Property Value
Type | Description |
---|---|
System.String |
PrivateServiceBusPublisher
Gets the private
Declaration
protected TopicClient PrivateServiceBusPublisher { get; }
Property Value
Type | Description |
---|---|
TopicClient |
PrivateServiceBusReceivers
Gets the private
Declaration
protected IDictionary<int, SubscriptionClient> PrivateServiceBusReceivers { get; }
Property Value
Type | Description |
---|---|
IDictionary<System.Int32, SubscriptionClient> |
PrivateTopicName
The name of the private topic.
Declaration
protected string PrivateTopicName { get; }
Property Value
Type | Description |
---|---|
System.String |
PrivateTopicNameConfigurationKey
The configuration key for the name of the private topic as used by IConfigurationManager.
Declaration
protected abstract string PrivateTopicNameConfigurationKey { get; }
Property Value
Type | Description |
---|---|
System.String |
PrivateTopicSubscriptionName
The name of the subscription in the private topic.
Declaration
protected string PrivateTopicSubscriptionName { get; }
Property Value
Type | Description |
---|---|
System.String |
PrivateTopicSubscriptionNameConfigurationKey
The configuration key for the name of the subscription in the private topic as used by IConfigurationManager.
Declaration
protected abstract string PrivateTopicSubscriptionNameConfigurationKey { get; }
Property Value
Type | Description |
---|---|
System.String |
PublicServiceBusPublisher
Gets the public
Declaration
protected TopicClient PublicServiceBusPublisher { get; }
Property Value
Type | Description |
---|---|
TopicClient |
PublicServiceBusReceivers
Gets the public
Declaration
protected IDictionary<int, SubscriptionClient> PublicServiceBusReceivers { get; }
Property Value
Type | Description |
---|---|
IDictionary<System.Int32, SubscriptionClient> |
PublicTopicName
The name of the public topic.
Declaration
protected string PublicTopicName { get; }
Property Value
Type | Description |
---|---|
System.String |
PublicTopicNameConfigurationKey
The configuration key for the name of the public topic as used by IConfigurationManager.
Declaration
protected abstract string PublicTopicNameConfigurationKey { get; }
Property Value
Type | Description |
---|---|
System.String |
PublicTopicSubscriptionName
The name of the subscription in the public topic.
Declaration
protected string PublicTopicSubscriptionName { get; }
Property Value
Type | Description |
---|---|
System.String |
PublicTopicSubscriptionNameConfigurationKey
The configuration key for the name of the subscription in the public topic as used by IConfigurationManager.
Declaration
protected abstract string PublicTopicSubscriptionNameConfigurationKey { get; }
Property Value
Type | Description |
---|---|
System.String |
ReceiverMessageHandler
The
Declaration
protected Action<BrokeredMessage> ReceiverMessageHandler { get; set; }
Property Value
Type | Description |
---|---|
Action<BrokeredMessage> |
ReceiverMessageHandlerOptions
The
Declaration
protected OnMessageOptions ReceiverMessageHandlerOptions { get; set; }
Property Value
Type | Description |
---|---|
OnMessageOptions |
TelemetryHelper
Gets the
Declaration
protected ITelemetryHelper TelemetryHelper { get; set; }
Property Value
Type | Description |
---|---|
ITelemetryHelper |
ThrowExceptionOnReceiverMessageLockLostExceptionDuringComplete
Specifies if an
Declaration
protected bool ThrowExceptionOnReceiverMessageLockLostExceptionDuringComplete { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ThrowExceptionOnReceiverMessageLockLostExceptionDuringCompleteConfigurationKey
The configuration key that
specifies if an
Declaration
protected abstract string ThrowExceptionOnReceiverMessageLockLostExceptionDuringCompleteConfigurationKey { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
ApplyReceiverMessageHandler()
Applies the stored ReceiverMessageHandler and ReceiverMessageHandlerOptions to all receivers in PrivateServiceBusReceivers and PublicServiceBusReceivers.
Declaration
protected override void ApplyReceiverMessageHandler()
Overrides
CheckPrivateTopicExists(NamespaceManager)
Checks if the private topic and subscription name exists as per PrivateTopicName and PrivateTopicSubscriptionName.
Declaration
protected virtual void CheckPrivateTopicExists(NamespaceManager namespaceManager)
Parameters
Type | Name | Description |
---|---|---|
NamespaceManager | namespaceManager | The |
CheckPublicTopicExists(NamespaceManager)
Checks if the public topic and subscription name exists as per PublicTopicName and PublicTopicSubscriptionName.
Declaration
protected virtual void CheckPublicTopicExists(NamespaceManager namespaceManager)
Parameters
Type | Name | Description |
---|---|---|
NamespaceManager | namespaceManager | The |
CheckTopicExists(NamespaceManager, String, String)
Checks if a topic by the provided topicName
exists and
Checks if a subscription name by the provided subscriptionName
exists.
Declaration
protected virtual void CheckTopicExists(NamespaceManager namespaceManager, string topicName, string subscriptionName)
Parameters
Type | Name | Description |
---|---|---|
NamespaceManager | namespaceManager | |
System.String | topicName | |
System.String | subscriptionName |
CleanUpDeadLetters(String, String)
Using a topicName
and topicSubscriptionName
.
Declaration
protected virtual CancellationTokenSource CleanUpDeadLetters(string topicName, string topicSubscriptionName)
Parameters
Type | Name | Description |
---|---|---|
System.String | topicName | The name of the topic. |
System.String | topicSubscriptionName | The name of the subscription. |
Returns
Type | Description |
---|---|
CancellationTokenSource |
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 CheckPrivateTopicExists(NamespaceManager) and CheckPublicTopicExists(NamespaceManager) then calling StartSettingsChecking()
Declaration
protected override void InstantiatePublishing()
Overrides
InstantiateReceiving()
Instantiate receiving on this bus by calling CheckPrivateTopicExists(NamespaceManager) and CheckPublicTopicExists(NamespaceManager) then InstantiateReceiving for private and public topics, calls CleanUpDeadLetters(String, String) for the private and public topics, then calling StartSettingsChecking()
Declaration
protected override void InstantiateReceiving()
Overrides
InstantiateReceiving(NamespaceManager, IDictionary<Int32, SubscriptionClient>, String, String)
Creates NumberOfReceiversCount
Declaration
protected virtual void InstantiateReceiving(NamespaceManager namespaceManager, IDictionary<int, SubscriptionClient> serviceBusReceivers, string topicName, string topicSubscriptionName)
Parameters
Type | Name | Description |
---|---|---|
NamespaceManager | namespaceManager | The |
IDictionary<System.Int32, SubscriptionClient> | serviceBusReceivers | The receivers collection to place |
System.String | topicName | The topic name. |
System.String | topicSubscriptionName | The topic subscription name. |
RegisterReceiverMessageHandler(Action<BrokeredMessage>, OnMessageOptions)
Registers the provided receiverMessageHandler
with the provided receiverMessageHandlerOptions
.
Declaration
protected virtual void RegisterReceiverMessageHandler(Action<BrokeredMessage> receiverMessageHandler, OnMessageOptions receiverMessageHandlerOptions)
Parameters
Type | Name | Description |
---|---|---|
Action<BrokeredMessage> | receiverMessageHandler | |
OnMessageOptions | receiverMessageHandlerOptions |
StoreReceiverMessageHandler(Action<BrokeredMessage>, OnMessageOptions)
Stores the provided receiverMessageHandler
and receiverMessageHandlerOptions
.
Declaration
protected virtual void StoreReceiverMessageHandler(Action<BrokeredMessage> receiverMessageHandler, OnMessageOptions receiverMessageHandlerOptions)
Parameters
Type | Name | Description |
---|---|---|
Action<BrokeredMessage> | receiverMessageHandler | |
OnMessageOptions | receiverMessageHandlerOptions |
TriggerSettingsChecking()
Triggers settings checking on both public and private publishers and receivers, then calls InstantiatePublishing() if PublicServiceBusPublisher is not null.
Declaration
protected override void TriggerSettingsChecking()
Overrides
TriggerSettingsChecking(TopicClient, IDictionary<Int32, SubscriptionClient>)
Triggers settings checking on the provided serviceBusPublisher
and serviceBusReceivers
,
then calls InstantiateReceiving().
Declaration
protected virtual void TriggerSettingsChecking(TopicClient serviceBusPublisher, IDictionary<int, SubscriptionClient> serviceBusReceivers)
Parameters
Type | Name | Description |
---|---|---|
TopicClient | serviceBusPublisher | |
IDictionary<System.Int32, SubscriptionClient> | serviceBusReceivers |