Table of Contents

Class ConsumerEndpointConfiguration

Namespace
Silverback.Messaging.Configuration
Assembly
Silverback.Integration.dll

The consumer configuration.

public abstract record ConsumerEndpointConfiguration : EndpointConfiguration, IEquatable<EndpointConfiguration>, IEquatable<ConsumerEndpointConfiguration>
Inheritance
ConsumerEndpointConfiguration
Implements
Derived
Inherited Members

Constructors

ConsumerEndpointConfiguration()

protected ConsumerEndpointConfiguration()

ConsumerEndpointConfiguration(ConsumerEndpointConfiguration)

protected ConsumerEndpointConfiguration(ConsumerEndpointConfiguration original)

Parameters

original ConsumerEndpointConfiguration

Properties

AllowStreaming

Gets a value indicating whether the subscribers can subscribe a stream (IAsyncEnumerable<T>, IEnumerable<T>, etc.) pushed with all messages consumed from that endpoint (or partition). This setup can be used for basic stream processing, but it's more fragile and should be used with care. Some features, like error policies, won't work as expected. The default is false.

public bool AllowStreaming { get; init; }

Property Value

bool

Batch

Gets the batch settings. Can be used to enable and setup batch processing. The default is null, which means that batch processing is disabled.

public BatchSettings? Batch { get; init; }

Property Value

BatchSettings

Deserializer

Gets the IMessageDeserializer to be used to deserialize the consumed messages. The default is the JsonMessageDeserializer<TMessage>.

public IMessageDeserializer Deserializer { get; init; }

Property Value

IMessageDeserializer

Encryption

Gets the encryption settings to be used to decrypt the encrypted messages. The default is null.

public IDecryptionSettings? Encryption { get; init; }

Property Value

IDecryptionSettings

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

ErrorPolicy

Gets the error policy to be applied when an exception occurs during the processing of the consumed messages. The default is the StopConsumerErrorPolicy.

public IErrorPolicy ErrorPolicy { get; init; }

Property Value

IErrorPolicy

Filter

Gets the IInboundMessageFilter to be used to filter out the consumed messages that should not be processed. The filtered messages aren't delivered to any subscriber and are committed (or acknowledged) like the messages that no subscriber handles. The default is null.

public IInboundMessageFilter? Filter { get; init; }

Property Value

IInboundMessageFilter

Remarks

When the filter is set via Filter<TFilter>(), the actual filter is resolved from the service provider for each message by the consumer pipeline. In that case, the value of this property only identifies the filter type and can't be invoked directly.

With batch processing, the filtered messages aren't part of any batch: Kafka commits them with the next commit of the same partition, so a partition whose latest messages are all filtered out keeps them uncommitted until a message of the partition is processed in a batch.

A filtered message isn't added to the sequence it belongs to and doesn't count toward its length. A custom ISequenceReader whose sequences are completed by their last message, or by a total length equal to the fixed number of messages they are made of, should therefore not be combined with a filter: a sequence whose last message (or any message, with a total length) is filtered out isn't completed and is eventually aborted as incomplete. The built-in batches, chunked messages and streams aren't affected.

Sequence

Gets 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.

public SequenceSettings Sequence { get; init; }

Property Value

SequenceSettings

ThrowIfUnhandled

Gets a value indicating whether an exception must be thrown if no subscriber is handling the received message. The default is true.

public bool ThrowIfUnhandled { get; init; }

Property Value

bool

Remarks

When false, an unhandled message is ignored without being added to the sequence it belongs to, which can prevent a custom sequence from being completed (see IgnoreUnhandledMessages()).

Methods

Equals(ConsumerEndpointConfiguration?)

public virtual bool Equals(ConsumerEndpointConfiguration? other)

Parameters

other ConsumerEndpointConfiguration

Returns

bool

Equals(EndpointConfiguration?)

public override sealed bool Equals(EndpointConfiguration? other)

Parameters

other EndpointConfiguration

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected override bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

ToString()

public override string ToString()

Returns

string

ValidateCore()

Validates the endpoint configuration and throws an BrokerConfigurationException if not valid.

protected override void ValidateCore()

Operators

operator ==(ConsumerEndpointConfiguration?, ConsumerEndpointConfiguration?)

public static bool operator ==(ConsumerEndpointConfiguration? left, ConsumerEndpointConfiguration? right)

Parameters

left ConsumerEndpointConfiguration
right ConsumerEndpointConfiguration

Returns

bool

operator !=(ConsumerEndpointConfiguration?, ConsumerEndpointConfiguration?)

public static bool operator !=(ConsumerEndpointConfiguration? left, ConsumerEndpointConfiguration? right)

Parameters

left ConsumerEndpointConfiguration
right ConsumerEndpointConfiguration

Returns

bool