Interface IMessageConsumer
Namespace: LemonEdge.Messaging.Core.Consumers.Abstractions
Assembly: LemonEdge.Messaging.Core.dll
Syntax
public interface IMessageConsumer
Methods
InitializeAsync(CancellationToken)
Performs all tasks required to initialize this message consumer
Declaration
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
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
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
void Unsubscribe(Guid subscriptionToken)
Parameters
Type | Name | Description |
---|---|---|
Guid | subscriptionToken | The token returned from the initial call to Subscribe<T> |