Class DefaultMessageConsumer
Implements
Inherited Members
Namespace: LemonEdge.Messaging.Core.Consumers
Assembly: LemonEdge.Messaging.Core.dll
Syntax
public class DefaultMessageConsumer : IMessageConsumer
Constructors
DefaultMessageConsumer()
Declaration
public DefaultMessageConsumer()
Methods
InitializeAsync(CancellationToken)
Performs all tasks required to initialize this message consumer
Declaration
public Task InitializeAsync(CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | token |
Returns
Type | Description |
---|---|
Task |
RegisterErrorHandler(Func<Exception, CancellationToken, Task>)
Registers an error handler for all message processing
Declaration
public Task RegisterErrorHandler(Func<Exception, CancellationToken, Task> callback)
Parameters
Type | Name | Description |
---|---|---|
Func<Exception, CancellationToken, Task> | callback | A delegate that will be executed when an exception occurs |
Returns
Type | Description |
---|---|
Task |
SubscribeAsync<T>(string, Func<T, CancellationToken, Task>, CancellationToken)
Creates a subscription to messages of type {T} for a specified topic
Declaration
public Task<Guid> SubscribeAsync<T>(string topicName, Func<T, CancellationToken, Task> callback, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
string | topicName | The topic to which will be subscribed |
Func<T, CancellationToken, Task> | callback | A delegate that will be executed when a message of type {T} is received |
CancellationToken | token |
Returns
Type | Description |
---|---|
Task<Guid> | A subscription token that may be used to unsubscribe |
Type Parameters
Name | Description |
---|---|
T |
Unsubscribe(Guid)
Unsubscribes the subscription indicated by the subscription token
Declaration
public void Unsubscribe(Guid subscriptionToken)
Parameters
Type | Name | Description |
---|---|---|
Guid | subscriptionToken | The token returned from the initial call to Subscribe<T> |