Show / Hide Table of Contents

    Interface IConsumer

    Consumes an endpoint and invokes a callback delegate when a message is received.

    Namespace: Silverback.Messaging.Broker
    Assembly: Silverback.Integration.dll
    Syntax
    public interface IConsumer

    Properties

    | Improve this doc View source

    Broker

    Gets the IBroker that owns this consumer.

    Declaration
    IBroker Broker { get; }
    Property Value
    Type Description
    IBroker
    | Improve this doc View source

    Endpoint

    Gets the IConsumerEndpoint representing the endpoint that is being consumed.

    Declaration
    IConsumerEndpoint Endpoint { get; }
    Property Value
    Type Description
    IConsumerEndpoint
    | Improve this doc View source

    Id

    Gets the InstanceIdentifier uniquely identifying the consumer instance.

    Declaration
    InstanceIdentifier Id { get; }
    Property Value
    Type Description
    InstanceIdentifier
    | Improve this doc View source

    IsConnected

    Gets a value indicating whether this consumer has successfully initialized the connection to the message broker.

    Declaration
    bool IsConnected { get; }
    Property Value
    Type Description
    bool
    Remarks

    This doesn't necessary mean that it is connected and ready to consume. The underlying library might handle the connection process asynchronously in the background or the protocol might require extra steps (e.g. Kafka might require the partitions to be assigned).

    | Improve this doc View source

    IsConnecting

    Gets a value indicating whether this consumer is initializing the connection to the message broker.

    Declaration
    bool IsConnecting { get; }
    Property Value
    Type Description
    bool
    | Improve this doc View source

    IsConsuming

    Gets a value indicating whether this consumer is connected and consuming (started).

    Declaration
    bool IsConsuming { get; }
    Property Value
    Type Description
    bool
    | Improve this doc View source

    StatusInfo

    Gets the IConsumerStatusInfo containing the status details and basic statistics of this consumer.

    Declaration
    IConsumerStatusInfo StatusInfo { get; }
    Property Value
    Type Description
    IConsumerStatusInfo

    Methods

    | Improve this doc View source

    CommitAsync(IBrokerMessageIdentifier)

    Confirms that the specified message has been successfully processed. The acknowledgement will be sent to the message broker and the message will never be consumed again (by the same logical consumer / consumer group).
    Declaration
    Task CommitAsync(IBrokerMessageIdentifier brokerMessageIdentifier)
    Parameters
    Type Name Description
    IBrokerMessageIdentifier brokerMessageIdentifier

    The identifier of the message to be committed.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    | Improve this doc View source

    CommitAsync(IReadOnlyCollection<IBrokerMessageIdentifier>)

    Confirms that the specified messages have been successfully processed. The acknowledgement will be sent to the message broker and the message will never be consumed again (by the same logical consumer / consumer group).
    Declaration
    Task CommitAsync(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.

    | Improve this doc View source

    ConnectAsync()

    Connects and starts consuming.

    Declaration
    Task ConnectAsync()
    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    | Improve this doc View source

    DisconnectAsync()

    Disconnects and stops consuming.

    Declaration
    Task DisconnectAsync()
    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    | 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
    IReadOnlyList<ISequenceStore> GetCurrentSequenceStores()
    Returns
    Type Description
    IReadOnlyList<ISequenceStore>

    The list of ISequenceStore.

    | Improve this doc View source

    IncrementFailedAttempts(IRawInboundEnvelope)

    Increments the stored failed attempts count for the specified envelope.

    Declaration
    int IncrementFailedAttempts(IRawInboundEnvelope envelope)
    Parameters
    Type Name Description
    IRawInboundEnvelope envelope

    The envelope.

    Returns
    Type Description
    int

    The current failed attempts count after the increment.

    | Improve this doc View source

    RollbackAsync(IBrokerMessageIdentifier)

    Notifies that an error occured while processing the specified message. If necessary the information will be sent to the message broker to ensure that the message will be consumed again.
    Declaration
    Task RollbackAsync(IBrokerMessageIdentifier brokerMessageIdentifier)
    Parameters
    Type Name Description
    IBrokerMessageIdentifier brokerMessageIdentifier

    The identifier of the message to be rolled back.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    | Improve this doc View source

    RollbackAsync(IReadOnlyCollection<IBrokerMessageIdentifier>)

    Notifies that an error occured while processing the specified messages. If necessary the information will be sent to the message broker to ensure that the message will be re-processed.
    Declaration
    Task RollbackAsync(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.

    | Improve this doc View source

    StartAsync()

    Starts consuming. Used after StopAsync() has been called to resume consuming.

    Declaration
    Task StartAsync()
    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    | Improve this doc View source

    StopAsync()

    Stops the consumer without disconnecting. Can be used to pause and resume consuming.

    Declaration
    Task StopAsync()
    Returns
    Type Description
    Task

    A Task representing the asynchronous operation. This Task will complete as soon as the stopping signal has been sent.

    | Improve this doc View source

    TriggerReconnectAsync()

    Stops the consumer and starts an asynchronous Task to disconnect and reconnect it.

    Declaration
    Task TriggerReconnectAsync()
    Returns
    Type Description
    Task

    A Task representing the asynchronous operation. This Task will complete as soon as the stopping signal has been sent, while the process will be completed in another asynchronous Task.

    • Improve this doc
    • View source
    GitHub E-Mail
    ↑ Back to top © 2020 Sergio Aquilini