Class Consumer<TBroker, TEndpoint, TIdentifier>
Consumes an endpoint and invokes a callback delegate when a message is received.
Inheritance
Inherited Members
Namespace: Silverback.Messaging.Broker
Assembly: Silverback.Integration.dll
Syntax
public abstract class Consumer<TBroker, TEndpoint, TIdentifier> : Consumer, IConsumer, IDisposable where TBroker : IBroker where TEndpoint : IConsumerEndpoint where TIdentifier : IBrokerMessageIdentifier
Type Parameters
Name | Description |
---|---|
TBroker | The type of the related IBroker implementation. |
TEndpoint | The type of the IConsumerEndpoint implementation used by this consumer implementation. |
TIdentifier | The type of the IBrokerMessageIdentifier used by this broker implementation. |
Constructors
| Improve this doc View sourceConsumer(TBroker, TEndpoint, IBrokerBehaviorsProvider<IConsumerBehavior>, IServiceProvider, IInboundLogger<Consumer<TBroker, TEndpoint, TIdentifier>>)
Initializes a new instance of the Consumer<TBroker, TEndpoint, TIdentifier> class.
Declaration
protected Consumer(TBroker broker, TEndpoint endpoint, IBrokerBehaviorsProvider<IConsumerBehavior> behaviorsProvider, IServiceProvider serviceProvider, IInboundLogger<Consumer<TBroker, TEndpoint, TIdentifier>> logger)
Parameters
Type | Name | Description |
---|---|---|
TBroker | broker | The IBroker that is instantiating the consumer. |
TEndpoint | endpoint | The endpoint to be consumed. |
IBrokerBehaviorsProvider<IConsumerBehavior> | behaviorsProvider | |
IServiceProvider | serviceProvider | The IServiceProvider to be used to resolve the needed services. |
IInboundLogger<Consumer<TBroker, TEndpoint, TIdentifier>> | logger |
Properties
| Improve this doc View sourceBroker
Gets the IBroker that owns this consumer.
Declaration
public TBroker Broker { get; }
Property Value
Type | Description |
---|---|
TBroker |
Endpoint
Gets the IConsumerEndpoint representing the endpoint that is being consumed.
Declaration
public TEndpoint Endpoint { get; }
Property Value
Type | Description |
---|---|
TEndpoint |
Methods
| Improve this doc View sourceCommitCoreAsync(IReadOnlyCollection<IBrokerMessageIdentifier>)
Commits the specified messages sending the acknowledgement to the message broker.
Declaration
protected override Task CommitCoreAsync(IReadOnlyCollection<IBrokerMessageIdentifier> brokerMessageIdentifiers)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<IBrokerMessageIdentifier> | brokerMessageIdentifiers | The identifiers of to message be committed. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
Overrides
| Improve this doc View sourceCommitCoreAsync(IReadOnlyCollection<TIdentifier>)
Commits the specified messages sending the acknowledgement to the message broker.
Declaration
protected abstract Task CommitCoreAsync(IReadOnlyCollection<TIdentifier> brokerMessageIdentifiers)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<TIdentifier> | brokerMessageIdentifiers | The identifiers of to message be committed. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
RollbackCoreAsync(IReadOnlyCollection<IBrokerMessageIdentifier>)
If necessary notifies the message broker that the specified messages couldn't be processed successfully, to ensure that they will be consumed again.
Declaration
protected override Task RollbackCoreAsync(IReadOnlyCollection<IBrokerMessageIdentifier> brokerMessageIdentifiers)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<IBrokerMessageIdentifier> | brokerMessageIdentifiers | The identifiers of to message be rolled back. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
Overrides
| Improve this doc View sourceRollbackCoreAsync(IReadOnlyCollection<TIdentifier>)
If necessary notifies the message broker that the specified messages couldn't be processed successfully, to ensure that they will be consumed again.
Declaration
protected abstract Task RollbackCoreAsync(IReadOnlyCollection<TIdentifier> brokerMessageIdentifiers)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<TIdentifier> | brokerMessageIdentifiers | The identifiers of to message be rolled back. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |