Class LambdaSharpEventBusClient
The LambdaSharpEventBusClient class is used to subscribing to events on the LambdaSharp App EventBus.
Inheritance
Namespace: LambdaSharp.App
Assembly: LambdaSharp.App.dll
Syntax
public sealed class LambdaSharpEventBusClient : IAsyncDisposable
Constructors
LambdaSharpEventBusClient(LambdaSharpAppConfig, ILogger<LambdaSharpEventBusClient>)
Initializes a new LambdaSharpEventBusClient instance.
Declaration
public LambdaSharpEventBusClient(LambdaSharpAppConfig config, ILogger<LambdaSharpEventBusClient> logger)
Parameters
Type | Name | Description |
---|---|---|
LambdaSharpAppConfig | config | A LambdaSharpAppConfig instance. |
Microsoft.Extensions.Logging.ILogger<LambdaSharpEventBusClient> | logger | A Microsoft.Extensions.Logging.ILogger instance. |
Methods
SubscribeTo<T>(String, EventBusPattern, Action<IEventBusSubscription, CloudWatchEvent<T>>)
The SubscribeTo<T>(String, EventBusPattern, Action<IEventBusSubscription, CloudWatchEvent<T>>) method creates a subscription for the specified source and type.
Declaration
public IEventBusSubscription SubscribeTo<T>(string name, EventBusPattern eventPattern, Action<IEventBusSubscription, CloudWatchEvent<T>> callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the LambdaSharp App EventBus subscription. |
EventBusPattern | eventPattern | |
System.Action<IEventBusSubscription, Amazon.Lambda.CloudWatchEvents.CloudWatchEvent<T>> | callback | The callback to invoke when a matching event is received. |
Returns
Type | Description |
---|---|
IEventBusSubscription | The subscription instance. |
Type Parameters
Name | Description |
---|---|
T | The event payload type. |
SubscribeTo<T>(String, Action<T>)
The SubscribeTo<T>(String, Action<T>) method creates a subscription for the specified source and type.
Declaration
public IEventBusSubscription SubscribeTo<T>(string source, Action<T> callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The name of the event source. |
System.Action<T> | callback | The callback to invoke when a matching event is received. |
Returns
Type | Description |
---|---|
IEventBusSubscription | The subscription instance. |
Type Parameters
Name | Description |
---|---|
T | The event payload type. |
SubscribeTo<T>(String, Action<CloudWatchEvent<T>>)
The SubscribeTo<T>(String, Action<CloudWatchEvent<T>>) method creates a subscription for the specified source and type.
Declaration
public IEventBusSubscription SubscribeTo<T>(string source, Action<CloudWatchEvent<T>> callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The name of the event source. |
System.Action<Amazon.Lambda.CloudWatchEvents.CloudWatchEvent<T>> | callback | The callback to invoke when a matching event is received. |
Returns
Type | Description |
---|---|
IEventBusSubscription | The subscription instance. |
Type Parameters
Name | Description |
---|---|
T | The event payload type. |
SubscribeTo<T>(String, Action<IEventBusSubscription, T>)
The SubscribeTo<T>(String, Action<IEventBusSubscription, T>) method creates a subscription for the specified source and type.
Declaration
public IEventBusSubscription SubscribeTo<T>(string source, Action<IEventBusSubscription, T> callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The name of the event source. |
System.Action<IEventBusSubscription, T> | callback | The callback to invoke when a matching event is received. |
Returns
Type | Description |
---|---|
IEventBusSubscription | The subscription instance. |
Type Parameters
Name | Description |
---|---|
T | The event payload type. |
SubscribeTo<T>(String, Action<IEventBusSubscription, CloudWatchEvent<T>>)
The SubscribeTo<T>(String, Action<IEventBusSubscription, CloudWatchEvent<T>>) method creates a subscription for the specified source and type.
Declaration
public IEventBusSubscription SubscribeTo<T>(string source, Action<IEventBusSubscription, CloudWatchEvent<T>> callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The name of the event source. |
System.Action<IEventBusSubscription, Amazon.Lambda.CloudWatchEvents.CloudWatchEvent<T>> | callback | The callback to invoke when a matching event is received. |
Returns
Type | Description |
---|---|
IEventBusSubscription | The subscription instance. |
Type Parameters
Name | Description |
---|---|
T | The event payload type. |
SubscribeTo<T>(String, Func<T, Task>)
The SubscribeTo<T>(String, Func<T, Task>) method creates a subscription for the specified source and type.
Declaration
public IEventBusSubscription SubscribeTo<T>(string source, Func<T, Task> callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The name of the event source. |
System.Func<T, System.Threading.Tasks.Task> | callback | The callback to invoke when a matching event is received. |
Returns
Type | Description |
---|---|
IEventBusSubscription | The subscription instance. |
Type Parameters
Name | Description |
---|---|
T | The event payload type. |
SubscribeTo<T>(String, Func<CloudWatchEvent<T>, Task>)
The SubscribeTo<T>(String, Func<CloudWatchEvent<T>, Task>) method creates a subscription for the specified source and type.
Declaration
public IEventBusSubscription SubscribeTo<T>(string source, Func<CloudWatchEvent<T>, Task> callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The name of the event source. |
System.Func<Amazon.Lambda.CloudWatchEvents.CloudWatchEvent<T>, System.Threading.Tasks.Task> | callback | The callback to invoke when a matching event is received. |
Returns
Type | Description |
---|---|
IEventBusSubscription | The subscription instance. |
Type Parameters
Name | Description |
---|---|
T | The event payload type. |
SubscribeTo<T>(String, Func<IEventBusSubscription, T, Task>)
The SubscribeTo<T>(String, Func<IEventBusSubscription, T, Task>) method creates a subscription for the specified source and type.
Declaration
public IEventBusSubscription SubscribeTo<T>(string source, Func<IEventBusSubscription, T, Task> callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The name of the event source. |
System.Func<IEventBusSubscription, T, System.Threading.Tasks.Task> | callback | The callback to invoke when a matching event is received. |
Returns
Type | Description |
---|---|
IEventBusSubscription | The subscription instance. |
Type Parameters
Name | Description |
---|---|
T | The event payload type. |
SubscribeTo<T>(String, Func<IEventBusSubscription, CloudWatchEvent<T>, Task>)
The SubscribeTo<T>(String, Func<IEventBusSubscription, CloudWatchEvent<T>, Task>) method creates a subscription for the specified source and type.
Declaration
public IEventBusSubscription SubscribeTo<T>(string source, Func<IEventBusSubscription, CloudWatchEvent<T>, Task> callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The name of the event source. |
System.Func<IEventBusSubscription, Amazon.Lambda.CloudWatchEvents.CloudWatchEvent<T>, System.Threading.Tasks.Task> | callback | The callback to invoke when a matching event is received. |
Returns
Type | Description |
---|---|
IEventBusSubscription | The subscription instance. |
Type Parameters
Name | Description |
---|---|
T | The event payload type. |
Events
StateChanged
The StateChanged event is raised when the connection state of the LambdaSharp App EventBus changes.
Declaration
public event EventHandler<EventBusStateChangedEventArgs> StateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<EventBusStateChangedEventArgs> |
SubscriptionError
The SubscriptionError event is raised when the LambdaSharp App EventBus receives a subscription error message.
Declaration
public event EventHandler<EventBusSubscriptErrorEventArgs> SubscriptionError
Event Type
Type | Description |
---|---|
System.EventHandler<EventBusSubscriptErrorEventArgs> |