Class ConsumerOptions
Options for configuring a message consumer of a queue.
Implements
Inherited Members
Namespace: CodersRealm.NmsAmqpClient
Assembly: CodersRealm.NmsAmqpClient.dll
Syntax
public record ConsumerOptions : IEquatable<ConsumerOptions>
Constructors
ConsumerOptions(IQueue?, string?, string?, bool, AcknowledgementMode, OnMessageReceivedHandlerAsync?, OnErrorHandlerAsync?, ConsumerTransformerAsync?, TimeSpan?)
Options for configuring a message consumer of a queue.
Declaration
public ConsumerOptions(IQueue? Queue = null, string? QueueName = null, string? MessageSelector = null, bool NoLocalMessages = false, AcknowledgementMode AcknowledgementMode = AcknowledgementMode.AutoAcknowledge, OnMessageReceivedHandlerAsync? OnMessageReceivedAsync = null, OnErrorHandlerAsync? OnErrorAsync = null, ConsumerTransformerAsync? ConsumerTransformer = null, TimeSpan? TransformerTimeout = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IQueue | Queue | The queue instance to consume from. If set, this takes precedence over QueueName. |
| string | QueueName | The name of the queue to consume from when Queue is not provided. |
| string | MessageSelector | A message selector expression used to filter messages delivered to the subscriber. See the underlying messaging provider for supported selector syntax. |
| bool | NoLocalMessages | If true, messages published from the same connection (local messages) will not be delivered to this consumer. |
| AcknowledgementMode | AcknowledgementMode | The acknowledgement mode used by the consumer. Defaults to Apache.NMS.AcknowledgementMode.AutoAcknowledge. |
| OnMessageReceivedHandlerAsync | OnMessageReceivedAsync | Asynchronous handler invoked when a message is received. |
| OnErrorHandlerAsync | OnErrorAsync | Asynchronous handler invoked when an error occurs while processing messages. |
| ConsumerTransformerAsync | ConsumerTransformer | Gets or sets the asynchronous transformer used to preprocess consumer messages. Note: Due to internal limitations, all your async calls from within the transformer must not capture the context and should use ConfigureAwait(false) to avoid deadlocks. |
| TimeSpan? | TransformerTimeout | Gets or sets the timeout duration for the consumer transformer. If a message transformation exceeds this duration, it will be considered failed. Defaults to |
Properties
AcknowledgementMode
The acknowledgement mode used by the consumer. Defaults to Apache.NMS.AcknowledgementMode.AutoAcknowledge.
Declaration
public AcknowledgementMode AcknowledgementMode { get; init; }
Property Value
| Type | Description |
|---|---|
| AcknowledgementMode |
ConsumerTransformer
Gets or sets the asynchronous transformer used to preprocess consumer messages. Note: Due to internal limitations, all your async calls from within the transformer must not capture the context and should use ConfigureAwait(false) to avoid deadlocks.
Declaration
public ConsumerTransformerAsync? ConsumerTransformer { get; init; }
Property Value
| Type | Description |
|---|---|
| ConsumerTransformerAsync |
MessageSelector
A message selector expression used to filter messages delivered to the subscriber. See the underlying messaging provider for supported selector syntax.
Declaration
public string? MessageSelector { get; init; }
Property Value
| Type | Description |
|---|---|
| string |
NoLocalMessages
If true, messages published from the same connection (local messages) will not be delivered to this consumer.
Declaration
public bool NoLocalMessages { get; init; }
Property Value
| Type | Description |
|---|---|
| bool |
OnErrorAsync
Asynchronous handler invoked when an error occurs while processing messages.
Declaration
public OnErrorHandlerAsync? OnErrorAsync { get; init; }
Property Value
| Type | Description |
|---|---|
| OnErrorHandlerAsync |
OnMessageReceivedAsync
Asynchronous handler invoked when a message is received.
Declaration
public OnMessageReceivedHandlerAsync? OnMessageReceivedAsync { get; init; }
Property Value
| Type | Description |
|---|---|
| OnMessageReceivedHandlerAsync |
Queue
The queue instance to consume from. If set, this takes precedence over QueueName.
Declaration
public IQueue? Queue { get; init; }
Property Value
| Type | Description |
|---|---|
| IQueue |
QueueName
The name of the queue to consume from when Queue is not provided.
Declaration
public string? QueueName { get; init; }
Property Value
| Type | Description |
|---|---|
| string |
TransformerTimeout
Gets or sets the timeout duration for the consumer transformer. If a message transformation exceeds this duration, it will be considered failed. Defaults to null, which indicates to use a 5 second timeout.
Declaration
public TimeSpan? TransformerTimeout { get; init; }
Property Value
| Type | Description |
|---|---|
| TimeSpan? |