Class RabbitConsumer
Consumes an endpoint and invokes a callback delegate when a message is received.
Inheritance
Inherited Members
Namespace: Silverback.Messaging.Broker
Assembly: Silverback.Integration.RabbitMQ.dll
Syntax
public class RabbitConsumer : Consumer<RabbitBroker, RabbitConsumerEndpoint, RabbitDeliveryTag>, IConsumer, IDisposable
Constructors
| Improve this doc View sourceRabbitConsumer(RabbitBroker, RabbitConsumerEndpoint, IBrokerBehaviorsProvider<IConsumerBehavior>, IServiceProvider, IInboundLogger<RabbitConsumer>)
Initializes a new instance of the RabbitConsumer class.
Declaration
public RabbitConsumer(RabbitBroker broker, RabbitConsumerEndpoint endpoint, IBrokerBehaviorsProvider<IConsumerBehavior> behaviorsProvider, IServiceProvider serviceProvider, IInboundLogger<RabbitConsumer> logger)
Parameters
Type | Name | Description |
---|---|---|
RabbitBroker | broker | The IBroker that is instantiating the consumer. |
RabbitConsumerEndpoint | endpoint | The endpoint to be consumed. |
IBrokerBehaviorsProvider<IConsumerBehavior> | behaviorsProvider | |
IServiceProvider | serviceProvider | The IServiceProvider to be used to resolve the needed services. |
IInboundLogger<RabbitConsumer> | logger |
Methods
| Improve this doc View sourceCommitCoreAsync(IReadOnlyCollection<RabbitDeliveryTag>)
Commits the specified messages sending the acknowledgement to the message broker.
Declaration
protected override Task CommitCoreAsync(IReadOnlyCollection<RabbitDeliveryTag> brokerMessageIdentifiers)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<RabbitDeliveryTag> | brokerMessageIdentifiers | The identifiers of to message be committed. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
Overrides
| Improve this doc View sourceConnectCoreAsync()
Connects to the message broker.
Declaration
protected override Task ConnectCoreAsync()
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
Overrides
| Improve this doc View sourceDisconnectCoreAsync()
Disconnects from the message broker.
Declaration
protected override Task DisconnectCoreAsync()
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
Overrides
| Improve this doc View sourceGetCurrentSequenceStores()
Gets the ISequenceStore instances used by this consumer. Some brokers will require
multiple stores (e.g. the KafkaConsumer
will create a store per each assigned partition).
Declaration
public override IReadOnlyList<ISequenceStore> GetCurrentSequenceStores()
Returns
Type | Description |
---|---|
IReadOnlyList<ISequenceStore> | The list of ISequenceStore. |
Overrides
Remarks
Used only for testing and maintained to preserve backward compatibility.
RollbackCoreAsync(IReadOnlyCollection<RabbitDeliveryTag>)
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<RabbitDeliveryTag> brokerMessageIdentifiers)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<RabbitDeliveryTag> | brokerMessageIdentifiers | The identifiers of to message be rolled back. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
Overrides
| Improve this doc View sourceStartCoreAsync()
Stops consuming while staying connected to the message broker.
Declaration
protected override Task StartCoreAsync()
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
Overrides
| Improve this doc View sourceStopCoreAsync()
Stops consuming while staying connected to the message broker.
Declaration
protected override Task StopCoreAsync()
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
Overrides
| Improve this doc View sourceWaitUntilConsumingStoppedCoreAsync()
Waits until the consuming is stopped.
Declaration
protected override Task WaitUntilConsumingStoppedCoreAsync()
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |