Class ConsumerEndpointBuilder<TEndpoint, TBuilder>
The base class for the builders of the types inheriting from ConsumerEndpoint.
Inherited Members
Namespace: Silverback.Messaging.Configuration
Assembly: Silverback.Integration.dll
Syntax
public abstract class ConsumerEndpointBuilder<TEndpoint, TBuilder> : EndpointBuilder<TEndpoint, TBuilder>, IConsumerEndpointBuilder<TBuilder>, IEndpointBuilder<TBuilder> where TEndpoint : ConsumerEndpoint where TBuilder : IConsumerEndpointBuilder<TBuilder>
Type Parameters
Name | Description |
---|---|
TEndpoint | The type of the endpoint being built. |
TBuilder | The actual builder type. |
Constructors
| Improve this doc View sourceConsumerEndpointBuilder(Type?, IEndpointsConfigurationBuilder?)
Initializes a new instance of the ConsumerEndpointBuilder<TEndpoint, TBuilder> class.
Declaration
protected ConsumerEndpointBuilder(Type? messageType = null, IEndpointsConfigurationBuilder? endpointsConfigurationBuilder = null)
Parameters
Type | Name | Description |
---|---|---|
Type | messageType | The type of the message being consumed. |
IEndpointsConfigurationBuilder | endpointsConfigurationBuilder | The optional reference to the IEndpointsConfigurationBuilder that instantiated the builder. |
Methods
| Improve this doc View sourceBuild()
Builds the endpoint instance.
Declaration
public override TEndpoint Build()
Returns
Type | Description |
---|---|
TEndpoint | The endpoint. |
Overrides
| Improve this doc View sourceDecrypt(EncryptionSettings)
Specifies the EncryptionSettings to be used to decrypt the messages.
Declaration
public TBuilder Decrypt(EncryptionSettings encryptionSettings)
Parameters
Type | Name | Description |
---|---|---|
EncryptionSettings | encryptionSettings | The EncryptionSettings. |
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
DeserializeUsing(IMessageSerializer)
Specifies the IMessageSerializer to be used to deserialize the messages.
Declaration
public TBuilder DeserializeUsing(IMessageSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
IMessageSerializer | serializer | The IMessageSerializer. |
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
EnableBatchProcessing(int, TimeSpan?)
Enables batch processing.
Declaration
public TBuilder EnableBatchProcessing(int batchSize, TimeSpan? maxWaitTime = null)
Parameters
Type | Name | Description |
---|---|---|
int | batchSize | The number of messages to be processed in batch. |
TimeSpan? | maxWaitTime | The maximum amount of time to wait for the batch to be filled. After this time the batch will be
completed even if the specified |
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
EnsureExactlyOnce(IExactlyOnceStrategy)
Specifies the strategy to be used to ensure that each message is processed exactly once.
Declaration
public TBuilder EnsureExactlyOnce(IExactlyOnceStrategy strategy)
Parameters
Type | Name | Description |
---|---|---|
IExactlyOnceStrategy | strategy | The IExactlyOnceStrategy. |
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
EnsureExactlyOnce(Action<IExactlyOnceStrategyBuilder>)
Specifies the strategy to be used to ensure that each message is processed exactly once.
Declaration
public TBuilder EnsureExactlyOnce(Action<IExactlyOnceStrategyBuilder> strategyBuilderAction)
Parameters
Type | Name | Description |
---|---|---|
Action<IExactlyOnceStrategyBuilder> | strategyBuilderAction | An Action<T> that takes the IExactlyOnceStrategyBuilder and configures it. |
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
HandleTombstoneMessages()
Specifies that the null messages have to be mapped to a Tombstone<TMessage> ( Tombstone). This is the default behavior, use the UseLegacyNullMessageHandling() or SkipNullMessages() methods to change it.
Declaration
public TBuilder HandleTombstoneMessages()
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
IgnoreUnhandledMessages()
Specifies that the message has to be silently ignored if no subscriber is handling it.
Declaration
public TBuilder IgnoreUnhandledMessages()
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
OnError(IErrorPolicy)
Specifies the error policy to be applied when an exception occurs during the processing of the consumed messages.
Declaration
public TBuilder OnError(IErrorPolicy errorPolicy)
Parameters
Type | Name | Description |
---|---|---|
IErrorPolicy | errorPolicy | The IErrorPolicy. |
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
OnError(Action<IErrorPolicyBuilder>)
Specifies the error policy to be applied when an exception occurs during the processing of the consumed messages.
Declaration
public TBuilder OnError(Action<IErrorPolicyBuilder> errorPolicyBuilderAction)
Parameters
Type | Name | Description |
---|---|---|
Action<IErrorPolicyBuilder> | errorPolicyBuilderAction | An Action<T> that takes the IErrorPolicyBuilder and configures it. |
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
SkipNullMessages()
Specifies that the null messages have to be silently skipped ( Skip).
Declaration
public TBuilder SkipNullMessages()
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
ThrowIfUnhandled()
Specifies that an exception must be thrown if no subscriber is handling the received message. This option is enabled by default. Use the IgnoreUnhandledMessages() to disable it.
Declaration
public TBuilder ThrowIfUnhandled()
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
UseLegacyNullMessageHandling()
Specifies that the null messages have to be forwarded as null
(
Legacy).
Declaration
public TBuilder UseLegacyNullMessageHandling()
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
WithSequenceTimeout(TimeSpan)
Sets the timeout after which an incomplete sequence that isn't pushed with new messages will be aborted and discarded. The default is a conservative 30 minutes.
Declaration
public TBuilder WithSequenceTimeout(TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeout | The timeout. |
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
Remarks
This setting is ignored for batches (BatchSequence), use the
maxWaitTime
parameter of
EnableBatchProcessing(int, TimeSpan?) instead.