Class ConsumerEndpoint
Represents a message broker endpoint to consume from (such as a Kafka topic or RabbitMQ queue or exchange).
Inheritance
Inherited Members
Namespace: Silverback.Messaging
Assembly: Silverback.Integration.dll
Syntax
public abstract class ConsumerEndpoint : Endpoint, IConsumerEndpoint, IEndpoint
Constructors
| Improve this doc View sourceConsumerEndpoint(string)
Initializes a new instance of the ConsumerEndpoint class.
Declaration
protected ConsumerEndpoint(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The endpoint name. |
Properties
| Improve this doc View sourceBatch
Gets or sets the batch settings. Can be used to enable and setup batch processing.
Declaration
public BatchSettings? Batch { get; set; }
Property Value
Type | Description |
---|---|
BatchSettings |
ErrorPolicy
Gets or sets the error policy to be applied when an exception occurs during the processing of the consumed messages.
Declaration
public IErrorPolicy ErrorPolicy { get; set; }
Property Value
Type | Description |
---|---|
IErrorPolicy |
ExactlyOnceStrategy
Gets or sets the strategy to be used to guarantee that each message is consumed only once.
Declaration
public IExactlyOnceStrategy? ExactlyOnceStrategy { get; set; }
Property Value
Type | Description |
---|---|
IExactlyOnceStrategy |
NullMessageHandlingStrategy
Gets or sets a value indicating how to handle the null messages. The default value is Tombstone.
Declaration
public NullMessageHandlingStrategy NullMessageHandlingStrategy { get; set; }
Property Value
Type | Description |
---|---|
NullMessageHandlingStrategy |
Sequence
Gets or sets the sequence settings. A sequence is a set of related messages, like the chunks belonging to the same message or the messages in a dataset.
Declaration
public SequenceSettings Sequence { get; set; }
Property Value
Type | Description |
---|---|
SequenceSettings |
ThrowIfUnhandled
Gets or sets a value indicating whether an exception must be thrown if no subscriber is handling the
received message. The default is true
.
Declaration
public bool ThrowIfUnhandled { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Improve this doc View sourceGetUniqueConsumerGroupName()
Gets a unique name for the consumer group (e.g. Kafka's consumer group id). This value (joint with the endpoint name) will be used for example to ensure the exactly-once delivery.
Declaration
public abstract string GetUniqueConsumerGroupName()
Returns
Type | Description |
---|---|
string | Returns the unique name for the consumer group. |
Remarks
It's not enough to use the endpoint name, since the same topic could be consumed by multiple consumer groups within the same process and/or using the same database to store the information needed to ensure the exactly-once delivery.
Validate()
Validates the endpoint configuration and throws an EndpointConfigurationException if not valid.
Declaration
public override void Validate()