Interface IAzureBusHelper<TAuthenticationToken>
A helper for Azure Service Bus and Event Hub.
Namespace: Cqrs.Azure.ServiceBus
Assembly: Cqrs.Azure.ServiceBus.dll
Syntax
public interface IAzureBusHelper<TAuthenticationToken>
Type Parameters
Name | Description |
---|---|
TAuthenticationToken | The |
Methods
DefaultReceiveCommand(ICommand<TAuthenticationToken>, RouteManager, String)
The default command handler that
check if the ICommand<TAuthenticationToken> has already been processed by this framework,
checks if the ICommand<TAuthenticationToken> is required,
finds the handler from the provided routeManager
.
Declaration
bool ? DefaultReceiveCommand(ICommand<TAuthenticationToken> command, RouteManager routeManager, string framework)
Parameters
Type | Name | Description |
---|---|---|
ICommand<TAuthenticationToken> | command | The ICommand<TAuthenticationToken> to process. |
RouteManager | routeManager | The RouteManager to get the ICommandHandler<TAuthenticationToken, TCommand> from. |
System.String | framework | The current framework. |
Returns
Type | Description |
---|---|
System.Nullable<System.Boolean> | True indicates the |
DefaultReceiveEvent(IEvent<TAuthenticationToken>, RouteManager, String)
The default event handler that
check if the IEvent<TAuthenticationToken> has already been processed by this framework,
checks if the IEvent<TAuthenticationToken> is required,
finds the handler from the provided routeManager
.
Declaration
bool ? DefaultReceiveEvent(IEvent<TAuthenticationToken> event, RouteManager routeManager, string framework)
Parameters
Type | Name | Description |
---|---|---|
IEvent<TAuthenticationToken> | event | The IEvent<TAuthenticationToken> to process. |
RouteManager | routeManager | The RouteManager to get the IEventHandler<TAuthenticationToken, TEvent> from. |
System.String | framework | The current framework. |
Returns
Type | Description |
---|---|
System.Nullable<System.Boolean> | True indicates the |
PrepareAndValidateCommand<TCommand>(TCommand, String)
Prepares and validates a ICommand<TAuthenticationToken> to be sent specifying the framework it is sent via.
Declaration
bool PrepareAndValidateCommand<TCommand>(TCommand command, string framework)where TCommand : ICommand<TAuthenticationToken>
Parameters
Type | Name | Description |
---|---|---|
TCommand | command | The ICommand<TAuthenticationToken> to send. |
System.String | framework | The framework the |
Returns
Type | Description |
---|---|
System.Boolean |
Type Parameters
Name | Description |
---|---|
TCommand | The |
PrepareAndValidateEvent<TEvent>(TEvent, String)
Prepares and validates an IEvent<TAuthenticationToken> to be sent specifying the framework it is sent via.
Declaration
bool PrepareAndValidateEvent<TEvent>(TEvent event, string framework)where TEvent : IEvent<TAuthenticationToken>
Parameters
Type | Name | Description |
---|---|---|
TEvent | event | The IEvent<TAuthenticationToken> to send. |
System.String | framework | The framework the |
Returns
Type | Description |
---|---|
System.Boolean |
Type Parameters
Name | Description |
---|---|
TEvent | The |
PrepareCommand<TCommand>(TCommand, String)
Prepares a ICommand<TAuthenticationToken> to be sent specifying the framework it is sent via.
Declaration
void PrepareCommand<TCommand>(TCommand command, string framework)where TCommand : ICommand<TAuthenticationToken>
Parameters
Type | Name | Description |
---|---|---|
TCommand | command | The ICommand<TAuthenticationToken> to send. |
System.String | framework | The framework the |
Type Parameters
Name | Description |
---|---|
TCommand | The |
PrepareEvent<TEvent>(TEvent, String)
Prepares an IEvent<TAuthenticationToken> to be sent specifying the framework it is sent via.
Declaration
void PrepareEvent<TEvent>(TEvent event, string framework)where TEvent : IEvent<TAuthenticationToken>
Parameters
Type | Name | Description |
---|---|---|
TEvent | event | The IEvent<TAuthenticationToken> to send. |
System.String | framework | The framework the |
Type Parameters
Name | Description |
---|---|
TEvent | The |
ReceiveCommand(String, Func<ICommand<TAuthenticationToken>, Nullable<Boolean>>, String, Action, Action)
Deserialises and processes the messageBody
received from the network through the provided receiveCommandHandler
.
Declaration
ICommand<TAuthenticationToken> ReceiveCommand(string messageBody, Func<ICommand<TAuthenticationToken>, bool ? > receiveCommandHandler, string messageId, Action skippedAction = null, Action lockRefreshAction = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | messageBody | A serialised IMessage. |
Func<ICommand<TAuthenticationToken>, System.Nullable<System.Boolean>> | receiveCommandHandler | The handler method that will process the ICommand<TAuthenticationToken>. |
System.String | messageId | The network id of the IMessage. |
Action | skippedAction | The |
Action | lockRefreshAction | The |
Returns
Type | Description |
---|---|
ICommand<TAuthenticationToken> | The ICommand<TAuthenticationToken> that was processed. |
ReceiveEvent(String, Func<IEvent<TAuthenticationToken>, Nullable<Boolean>>, String, Action, Action)
Deserialises and processes the messageBody
received from the network through the provided receiveEventHandler
.
Declaration
IEvent<TAuthenticationToken> ReceiveEvent(string messageBody, Func<IEvent<TAuthenticationToken>, bool ? > receiveEventHandler, string messageId, Action skippedAction = null, Action lockRefreshAction = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | messageBody | A serialised IMessage. |
Func<IEvent<TAuthenticationToken>, System.Nullable<System.Boolean>> | receiveEventHandler | The handler method that will process the IEvent<TAuthenticationToken>. |
System.String | messageId | The network id of the IMessage. |
Action | skippedAction | The |
Action | lockRefreshAction | The |
Returns
Type | Description |
---|---|
IEvent<TAuthenticationToken> | The IEvent<TAuthenticationToken> that was processed. |
RefreshLock(CancellationTokenSource, BrokeredMessage, String)
Refreshes the network lock.
Declaration
void RefreshLock(CancellationTokenSource brokeredMessageRenewCancellationTokenSource, BrokeredMessage message, string type = "message")
Parameters
Type | Name | Description |
---|---|---|
CancellationTokenSource | brokeredMessageRenewCancellationTokenSource | |
BrokeredMessage | message | |
System.String | type |
RegisterGlobalEventHandler<TMessage>(ITelemetryHelper, RouteManager, Action<TMessage>, Boolean)
Register an event handler that will listen and respond to all events.
Declaration
void RegisterGlobalEventHandler<TMessage>(ITelemetryHelper telemetryHelper, RouteManager routeManger, Action<TMessage> handler, bool holdMessageLock = true)where TMessage : IMessage
Parameters
Type | Name | Description |
---|---|---|
ITelemetryHelper | telemetryHelper | |
RouteManager | routeManger | |
Action<TMessage> | handler | |
System.Boolean | holdMessageLock |
Type Parameters
Name | Description |
---|---|
TMessage |
RegisterHandler<TMessage>(ITelemetryHelper, RouteManager, Action<TMessage>, Type, Boolean)
Manually registers the provided handler
on the provided routeManger
Declaration
void RegisterHandler<TMessage>(ITelemetryHelper telemetryHelper, RouteManager routeManger, Action<TMessage> handler, Type targetedType, bool holdMessageLock = true)where TMessage : IMessage
Parameters
Type | Name | Description |
---|---|---|
ITelemetryHelper | telemetryHelper | |
RouteManager | routeManger | |
Action<TMessage> | handler | |
Type | targetedType | |
System.Boolean | holdMessageLock |
Type Parameters
Name | Description |
---|---|
TMessage | The |