Class SubscriberOptions
Options used to configure a subscriber to a topic.
Implements
Inherited Members
Namespace: CodersRealm.AmqpClient
Assembly: CodersRealm.AmqpClient.dll
Syntax
public record SubscriberOptions : IEquatable<SubscriberOptions>
Constructors
SubscriberOptions(ITopic?, string?, string?, string?, bool, bool, bool, AcknowledgementMode, bool, MessageProcessorAsync?, ErrorHandlerAsync?)
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, bool UseConcurrency = false, MessageProcessorAsync? OnMessageReceivedAsync = null, ErrorHandlerAsync? OnErrorAsync = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ITopic | Topic | An 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 AutoAcknowledge. |
| bool | UseConcurrency | When true, messages will be processed concurrently. Default is false. |
| MessageProcessorAsync | OnMessageReceivedAsync | Asynchronous handler invoked when a message is received for this subscriber. |
| ErrorHandlerAsync | OnErrorAsync | Asynchronous handler invoked when an error occurs related to this subscriber. |
Properties
AcknowledgementMode
The acknowledgement mode to use for the subscriber. Defaults to 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 ErrorHandlerAsync? OnErrorAsync { get; init; }
Property Value
| Type | Description |
|---|---|
| ErrorHandlerAsync |
OnMessageReceivedAsync
Asynchronous handler invoked when a message is received for this subscriber.
Declaration
public MessageProcessorAsync? OnMessageReceivedAsync { get; init; }
Property Value
| Type | Description |
|---|---|
| MessageProcessorAsync |
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 |
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
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 |
UseConcurrency
When true, messages will be processed concurrently. Default is false.
Declaration
public bool UseConcurrency { get; init; }
Property Value
| Type | Description |
|---|---|
| bool |