Class SubscriberOptions
Options used to configure a subscriber to a topic.
Implements
Inherited Members
Namespace: CodersRealm.NmsAmqpClient
Assembly: CodersRealm.NmsAmqpClient.dll
Syntax
public record SubscriberOptions : IEquatable<SubscriberOptions>
Constructors
SubscriberOptions(ITopic?, string?, string?, string?, bool, bool, bool, AcknowledgementMode, OnMessageReceivedHandlerAsync?, OnErrorHandlerAsync?, SubscriberTransformerAsync?, TimeSpan?)
Options used to configure a subscriber to a topic.
Declaration
public SubscriberOptions(ITopic? Topic = null, string? TopicName = null, string? SubscriptionName = null, string? MessageSelector = null, bool NoLocalMessages = false, bool DurableSubscriber = false, bool SharedTopic = false, AcknowledgementMode AcknowledgementMode = AcknowledgementMode.AutoAcknowledge, OnMessageReceivedHandlerAsync? OnMessageReceivedAsync = null, OnErrorHandlerAsync? OnErrorAsync = null, SubscriberTransformerAsync? SubscriberTransformer = null, TimeSpan? TransformerTimeout = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ITopic | Topic | An Apache.NMS.ITopic instance to subscribe to. If provided, TopicName is not required. |
| string | TopicName | The name of the topic to subscribe to when Topic is not provided. |
| string | SubscriptionName | The subscription name to use when creating a durable or named subscription. |
| 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 | When true, messages published by the same connection that created the subscriber will not be delivered to it. Defaults to |
| bool | DurableSubscriber | When true, the subscriber will be created as durable. Durable subscribers survive client restarts when supported by the broker. Defaults to |
| bool | SharedTopic | When true, the subscription will be shared among multiple consumers when the messaging provider supports shared topics. Defaults to |
| AcknowledgementMode | AcknowledgementMode | The acknowledgement mode to use for the subscriber. Defaults to Apache.NMS.AcknowledgementMode.AutoAcknowledge. |
| OnMessageReceivedHandlerAsync | OnMessageReceivedAsync | Asynchronous handler invoked when a message is received for this subscriber. |
| OnErrorHandlerAsync | OnErrorAsync | Asynchronous handler invoked when an error occurs related to this subscriber. |
| SubscriberTransformerAsync | SubscriberTransformer | Gets or sets the asynchronous transformer used to preprocess subscriber 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 subscriber transformer. If a message transformation exceeds this duration, it will be considered failed. Defaults to |
Properties
AcknowledgementMode
The acknowledgement mode to use for the subscriber. Defaults to Apache.NMS.AcknowledgementMode.AutoAcknowledge.
Declaration
public AcknowledgementMode AcknowledgementMode { get; init; }
Property Value
| Type | Description |
|---|---|
| AcknowledgementMode |
DurableSubscriber
When true, the subscriber will be created as durable. Durable subscribers survive client restarts when supported by the broker. Defaults to false.
Declaration
public bool DurableSubscriber { get; init; }
Property Value
| Type | Description |
|---|---|
| bool |
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
When true, messages published by the same connection that created the subscriber will not be delivered to it. Defaults to false.
Declaration
public bool NoLocalMessages { get; init; }
Property Value
| Type | Description |
|---|---|
| bool |
OnErrorAsync
Asynchronous handler invoked when an error occurs related to this subscriber.
Declaration
public OnErrorHandlerAsync? OnErrorAsync { get; init; }
Property Value
| Type | Description |
|---|---|
| OnErrorHandlerAsync |
OnMessageReceivedAsync
Asynchronous handler invoked when a message is received for this subscriber.
Declaration
public OnMessageReceivedHandlerAsync? OnMessageReceivedAsync { get; init; }
Property Value
| Type | Description |
|---|---|
| OnMessageReceivedHandlerAsync |
SharedTopic
When true, the subscription will be shared among multiple consumers when the messaging provider supports shared topics. Defaults to false.
Declaration
public bool SharedTopic { get; init; }
Property Value
| Type | Description |
|---|---|
| bool |
SubscriberTransformer
Gets or sets the asynchronous transformer used to preprocess subscriber 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 SubscriberTransformerAsync? SubscriberTransformer { get; init; }
Property Value
| Type | Description |
|---|---|
| SubscriberTransformerAsync |
SubscriptionName
The subscription name to use when creating a durable or named subscription.
Declaration
public string? SubscriptionName { get; init; }
Property Value
| Type | Description |
|---|---|
| string |
Topic
An Apache.NMS.ITopic instance to subscribe to. If provided, TopicName is not required.
Declaration
public ITopic? Topic { get; init; }
Property Value
| Type | Description |
|---|---|
| ITopic |
TopicName
The name of the topic to subscribe to when Topic is not provided.
Declaration
public string? TopicName { get; init; }
Property Value
| Type | Description |
|---|---|
| string |
TransformerTimeout
Gets or sets the timeout duration for the subscriber 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? |