Class MqttConsumer
Consumes an endpoint and invokes a callback delegate when a message is received.
Inheritance
Inherited Members
Namespace: Silverback.Messaging.Broker
Assembly: Silverback.Integration.MQTT.dll
Syntax
public class MqttConsumer : Consumer<MqttBroker, MqttConsumerEndpoint, MqttMessageIdentifier>, IConsumer, IDisposable
Constructors
| Improve this doc View sourceMqttConsumer(MqttBroker, MqttConsumerEndpoint, IBrokerBehaviorsProvider<IConsumerBehavior>, IServiceProvider, IInboundLogger<MqttConsumer>)
Initializes a new instance of the Mqtt
Declaration
public MqttConsumer(MqttBroker broker, MqttConsumerEndpoint endpoint, IBrokerBehaviorsProvider<IConsumerBehavior> behaviorsProvider, IServiceProvider serviceProvider, IInboundLogger<MqttConsumer> logger)
Parameters
Type | Name | Description |
---|---|---|
Mqtt |
broker | The IBroker that is instantiating the consumer. |
Mqtt |
endpoint | The endpoint to be consumed. |
IBroker |
behaviorsProvider | |
IService |
serviceProvider | The IService |
IInbound |
logger |
Methods
| Improve this doc View sourceCommitCoreAsync(IReadOnlyCollection<MqttMessageIdentifier>)
Commits the specified messages sending the acknowledgement to the message broker.
Declaration
protected override Task CommitCoreAsync(IReadOnlyCollection<MqttMessageIdentifier> brokerMessageIdentifiers)
Parameters
Type | Name | Description |
---|---|---|
IRead |
brokerMessageIdentifiers | The identifiers of to message be committed. |
Returns
Overrides
| Improve this doc View sourceConnectCoreAsync()
Connects to the message broker.
Declaration
protected override Task ConnectCoreAsync()
Returns
Overrides
| Improve this doc View sourceDisconnectCoreAsync()
Disconnects from the message broker.
Declaration
protected override Task DisconnectCoreAsync()
Returns
Overrides
| Improve this doc View sourceDispose(bool)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | A value indicating whether the method has been called by the |
Overrides
| Improve this doc View sourceGetCurrentSequenceStores()
Gets the ISequenceKafkaConsumer
will create a store per each assigned partition).
Declaration
public override IReadOnlyList<ISequenceStore> GetCurrentSequenceStores()
Returns
Type | Description |
---|---|
IRead |
The list of ISequence |
Overrides
Remarks
Used only for testing and maintained to preserve backward compatibility.
RollbackCoreAsync(IReadOnlyCollection<MqttMessageIdentifier>)
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<MqttMessageIdentifier> brokerMessageIdentifiers)
Parameters
Type | Name | Description |
---|---|---|
IRead |
brokerMessageIdentifiers | The identifiers of to message be rolled back. |
Returns
Overrides
| Improve this doc View sourceStartCoreAsync()
Starts consuming. Called to resume consuming after Stop
Declaration
protected override Task StartCoreAsync()
Returns
Overrides
| Improve this doc View sourceStopCoreAsync()
Stops consuming while staying connected to the message broker.
Declaration
protected override Task StopCoreAsync()
Returns
Overrides
| Improve this doc View sourceWaitUntilConsumingStoppedCoreAsync()
Waits until the consuming is stopped.
Declaration
protected override Task WaitUntilConsumingStoppedCoreAsync()