Struct MessageBrokerListenerOptions
- Namespace
- LfrlAnvil.MessageBroker.Client
- Assembly
- LfrlAnvil.MessageBroker.Client.dll
Represents available MessageBrokerListener options during its binding.
public readonly struct MessageBrokerListenerOptions
- Inherited Members
Fields
DefaultPrefetchHint
Default PrefetchHint. Equal to 1.
public const short DefaultPrefetchHint = 1
Field Value
Properties
AreAcksEnabled
Specifies whether the client is expected to send ACK or negative ACK to the server in order to confirm message notification.
public bool AreAcksEnabled { get; }
Property Value
Remarks
This will always be enabled when MaxRetries or MaxRedeliveries or DeadLetterCapacityHint is greater than 0.
DeadLetterCapacityHint
Specifies how many messages will be stored at most by the dead letter.
public int DeadLetterCapacityHint { get; }
Property Value
Remarks
This is a min value. Actual value is dependent on all listeners attached to the queue and the state of the queue's dead letter.
Default
Represents default options, with default prefetch hint, disabled retries and redeliveries and dead letter, lack of filter expression, and enabled ACKs.
public static MessageBrokerListenerOptions Default { get; }
Property Value
DefaultMinAckTimeout
Default MinAckTimeout. Equal to 10 minutes.
public static Duration DefaultMinAckTimeout { get; }
Property Value
DefaultRetryDelay
Default RetryDelay. Equal to 30 seconds.
public static Duration DefaultRetryDelay { get; }
Property Value
FilterExpression
Specifies server-side message filter expression.
public string? FilterExpression { get; }
Property Value
MaxRedeliveries
Specifies how many times the server will attempt to automatically send a message notification redelivery when the client fails to respond with either an ACK or a negative ACK in time (see MinAckTimeout), before giving up.
public int MaxRedeliveries { get; }
Property Value
Remarks
Redelivery will be disabled when value is equal 0.
MaxRetries
Specifies how many times the server will attempt to automatically send a message notification retry when the client responds with a negative ACK, before giving up.
public int MaxRetries { get; }
Property Value
Remarks
Retries will be disabled when value is equal 0.
MinAckTimeout
Specifies the minimum amount of time that the server will wait for the client to send either an ACK or a negative ACK before attempting a message notification redelivery. Actual ACK timeout may be different due to the state of the queue and other listeners bound to it.
public Duration MinAckTimeout { get; }
Property Value
Remarks
Equal to Zero when AreAcksEnabled is equal to false.
MinDeadLetterRetention
Specifies the retention period for messages stored in the dead letter.
public Duration MinDeadLetterRetention { get; }
Property Value
Remarks
This is a min value. Actual value is dependent on all listeners attached to the queue and the state of the queue's dead letter.
PrefetchHint
Specifies how many messages intended for the created listener can be sent by the server to the client at the same time.
public short PrefetchHint { get; }
Property Value
Remarks
This is a max potential value. Actual value is dependent on all listeners attached to the queue and all of its currently pending messages.
RetryDelay
Specifies the delay between the server successfully processing negative ACK sent by the client and the server sending a message notification retry.
public Duration RetryDelay { get; }
Property Value
Remarks
Equal to Zero when MaxRetries is equal to 0.
Methods
EnableAcks(bool)
Allows to change AreAcksEnabled.
[Pure]
public MessageBrokerListenerOptions EnableAcks(bool enabled = true)
Parameters
enabledboolNew AreAcksEnabled value. Value will be ignored when MaxRetries or MaxRedeliveries or DeadLetterCapacityHint is greater than 0. Equal to true by default.
Returns
- MessageBrokerListenerOptions
New MessageBrokerListenerOptions instance.
SetDeadLetterPolicy(int, Duration)
Allows to change DeadLetterCapacityHint and MinDeadLetterRetention.
[Pure]
public MessageBrokerListenerOptions SetDeadLetterPolicy(int capacityHint, Duration minRetention)
Parameters
capacityHintintNew DeadLetterCapacityHint value.
minRetentionDurationNew MinDeadLetterRetention value. Sub-millisecond components will be trimmed. Value will be ignored when DeadLetterCapacityHint is equal to 0.
Returns
- MessageBrokerListenerOptions
New MessageBrokerListenerOptions instance.
Exceptions
- ArgumentOutOfRangeException
When
capacityHintis less than 0 or whencapacityHintis greater than 0 andminRetentionis less than 1 ms or whencapacityHintis equal to 0 andminRetentionis less than 0.
SetFilterExpression(string?)
Allows to change FilterExpression.
[Pure]
public MessageBrokerListenerOptions SetFilterExpression(string? value)
Parameters
valuestringNew FilterExpression value.
Returns
- MessageBrokerListenerOptions
New MessageBrokerListenerOptions instance.
Exceptions
- ArgumentException
When
valueis not null and consists only of white-space characters.
SetMaxRedeliveries(int)
Allows to change MaxRedeliveries.
[Pure]
public MessageBrokerListenerOptions SetMaxRedeliveries(int value)
Parameters
valueintNew MaxRedeliveries value.
Returns
- MessageBrokerListenerOptions
New MessageBrokerListenerOptions instance.
Exceptions
- ArgumentOutOfRangeException
When
valueis less than 0.
SetMinAckTimeout(Duration?)
Allows to change MinAckTimeout.
[Pure]
public MessageBrokerListenerOptions SetMinAckTimeout(Duration? value)
Parameters
valueDuration?New explicit MinAckTimeout value. Sub-millisecond components will be trimmed. Value will be ignored when AreAcksEnabled is equal to false.
Returns
- MessageBrokerListenerOptions
New MessageBrokerListenerOptions instance.
Exceptions
- ArgumentOutOfRangeException
When
valueis not null and is not in [1 ms, 2147483647 ms] range.
SetPrefetchHint(short?)
Allows to change PrefetchHint.
[Pure]
public MessageBrokerListenerOptions SetPrefetchHint(short? value)
Parameters
valueshort?New value.
Returns
- MessageBrokerListenerOptions
New MessageBrokerListenerOptions instance.
Exceptions
- ArgumentOutOfRangeException
When
valueis not null and is less than 1.
SetRetryPolicy(int, Duration?)
Allows to change MaxRetries and RetryDelay.
[Pure]
public MessageBrokerListenerOptions SetRetryPolicy(int maxRetries, Duration? delay = null)
Parameters
maxRetriesintNew MaxRetries value.
delayDuration?Optional new explicit RetryDelay value. Sub-millisecond components will be trimmed. Value will be ignored when MaxRetries is equal to 0. Equal to null by default.
Returns
- MessageBrokerListenerOptions
New MessageBrokerListenerOptions instance.
Exceptions
- ArgumentOutOfRangeException
When
maxRetriesis less than 0 or whendelayis not null and is not in [0, 2147483647 ms] range.