Class Consumer
Inheritance
System.Object
Consumer
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Silverback.Integration.dll
Syntax
public abstract class Consumer : IConsumer, IDisposable
Constructors
|
Improve this doc
View source
Consumer(IBroker, IConsumerEndpoint, IBrokerBehaviorsProvider<IConsumerBehavior>, IServiceProvider, ISilverbackLogger<Consumer>)
Initializes a new instance of the Consumer class.
Declaration
protected Consumer(IBroker broker, IConsumerEndpoint endpoint, IBrokerBehaviorsProvider<IConsumerBehavior> behaviorsProvider, IServiceProvider serviceProvider, ISilverbackLogger<Consumer> logger)
Parameters
Properties
|
Improve this doc
View source
Broker
Declaration
public IBroker Broker { get; }
Property Value
|
Improve this doc
View source
Endpoint
Declaration
public IConsumerEndpoint Endpoint { get; }
Property Value
|
Improve this doc
View source
Id
Declaration
public InstanceIdentifier Id { get; }
Property Value
|
Improve this doc
View source
IsConnected
Declaration
public bool IsConnected { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this doc
View source
IsConnecting
Declaration
public bool IsConnecting { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this doc
View source
IsConsuming
Declaration
public bool IsConsuming { get; protected set; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this doc
View source
IsDisconnecting
Gets a value indicating whether the consumer is being disconnected.
Declaration
public bool IsDisconnecting { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this doc
View source
IsStopping
Gets a value indicating whether the consumer is being stopped.
Declaration
protected bool IsStopping { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this doc
View source
ServiceProvider
Gets the System.IServiceProvider to be used to resolve the required services.
Declaration
protected IServiceProvider ServiceProvider { get; }
Property Value
Type |
Description |
System.IServiceProvider |
|
|
Improve this doc
View source
StatusInfo
Declaration
public IConsumerStatusInfo StatusInfo { get; }
Property Value
Methods
|
Improve this doc
View source
CommitAsync(IBrokerMessageIdentifier)
Declaration
public Task CommitAsync(IBrokerMessageIdentifier brokerMessageIdentifier)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this doc
View source
CommitAsync(IReadOnlyCollection<IBrokerMessageIdentifier>)
Declaration
public async Task CommitAsync(IReadOnlyCollection<IBrokerMessageIdentifier> brokerMessageIdentifiers)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this doc
View source
CommitCoreAsync(IReadOnlyCollection<IBrokerMessageIdentifier>)
Commits the specified messages sending the acknowledgement to the message broker.
Declaration
protected abstract Task CommitCoreAsync(IReadOnlyCollection<IBrokerMessageIdentifier> brokerMessageIdentifiers)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IReadOnlyCollection<IBrokerMessageIdentifier> |
brokerMessageIdentifiers |
The identifiers of to message be committed.
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
A System.Threading.Tasks.Task representing the asynchronous operation.
|
|
Improve this doc
View source
ConnectAsync()
Declaration
public async Task ConnectAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this doc
View source
ConnectCoreAsync()
Connects to the message broker.
Declaration
protected abstract Task ConnectCoreAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
A System.Threading.Tasks.Task representing the asynchronous operation.
|
|
Improve this doc
View source
DisconnectAsync()
Declaration
public async Task DisconnectAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this doc
View source
DisconnectCoreAsync()
Disconnects from the message broker.
Declaration
protected abstract Task DisconnectCoreAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
A System.Threading.Tasks.Task representing the asynchronous operation.
|
|
Improve this doc
View source
Dispose()
Declaration
|
Improve this doc
View source
Dispose(Boolean)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged
resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type |
Name |
Description |
System.Boolean |
disposing |
A value indicating whether the method has been called by the Dispose method and not from the
finalizer.
|
|
Improve this doc
View source
GetCurrentSequenceStores()
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 abstract IReadOnlyList<ISequenceStore> GetCurrentSequenceStores()
Returns
|
Improve this doc
View source
HandleMessageAsync(Byte[], IReadOnlyCollection<MessageHeader>, String, IBrokerMessageIdentifier, ISequenceStore)
Declaration
protected virtual async Task HandleMessageAsync(byte[] message, IReadOnlyCollection<MessageHeader> headers, string sourceEndpointName, IBrokerMessageIdentifier brokerMessageIdentifier, ISequenceStore sequenceStore)
Parameters
Type |
Name |
Description |
System.Byte[] |
message |
The body of the consumed message.
|
System.Collections.Generic.IReadOnlyCollection<MessageHeader> |
headers |
The headers of the consumed message.
|
System.String |
sourceEndpointName |
The name of the actual endpoint (topic) where the message has been delivered.
|
IBrokerMessageIdentifier |
brokerMessageIdentifier |
The identifier of the consumed message.
|
ISequenceStore |
sequenceStore |
The ISequenceStore to be used.
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
A System.Threading.Tasks.Task representing the asynchronous operation.
|
|
Improve this doc
View source
IncrementFailedAttempts(IRawInboundEnvelope)
Declaration
public int IncrementFailedAttempts(IRawInboundEnvelope envelope)
Parameters
Returns
Type |
Description |
System.Int32 |
|
|
Improve this doc
View source
RevertReadyStatus()
Called when the connection is lost to transitions the consumer back to
Connected.
Declaration
protected void RevertReadyStatus()
|
Improve this doc
View source
RollbackAsync(IBrokerMessageIdentifier)
Declaration
public Task RollbackAsync(IBrokerMessageIdentifier brokerMessageIdentifier)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this doc
View source
RollbackAsync(IReadOnlyCollection<IBrokerMessageIdentifier>)
Declaration
public Task RollbackAsync(IReadOnlyCollection<IBrokerMessageIdentifier> brokerMessageIdentifiers)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this doc
View source
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 abstract Task RollbackCoreAsync(IReadOnlyCollection<IBrokerMessageIdentifier> brokerMessageIdentifiers)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IReadOnlyCollection<IBrokerMessageIdentifier> |
brokerMessageIdentifiers |
The identifiers of to message be rolled back.
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
A System.Threading.Tasks.Task representing the asynchronous operation.
|
|
Improve this doc
View source
SetReadyStatus()
Called when fully connected to transitions the consumer to Ready.
Declaration
protected void SetReadyStatus()
|
Improve this doc
View source
StartAsync()
Declaration
public async Task StartAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this doc
View source
StartCoreAsync()
Starts consuming. Called to resume consuming after StopAsync() has been called.
Declaration
protected abstract Task StartCoreAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
A System.Threading.Tasks.Task representing the asynchronous operation.
|
|
Improve this doc
View source
StopAsync()
Declaration
public async Task StopAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this doc
View source
StopCoreAsync()
Stops consuming while staying connected to the message broker.
Declaration
protected abstract Task StopCoreAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
A System.Threading.Tasks.Task representing the asynchronous operation.
|
|
Improve this doc
View source
TriggerReconnectAsync()
Declaration
public async Task TriggerReconnectAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this doc
View source
WaitUntilConsumingStoppedCoreAsync()
Waits until the consuming is stopped.
Declaration
protected abstract Task WaitUntilConsumingStoppedCoreAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
A System.Threading.Tasks.Task representing the asynchronous operation.
|
Implements
System.IDisposable