Interface IProducer
Defines the contract for a message producer that creates and sends messages to queues or topics in a messaging system. Provides asynchronous methods for message creation, sending, and transaction management. Implementations are expected to be safe for concurrent use and to honor cancellation semantics where applicable.
Inherited Members
Namespace: CodersRealm.AmqpClient
Assembly: CodersRealm.AmqpClient.dll
Syntax
public interface IProducer : IMessageProducer, IMessageCreator, IDestinationProvider
Properties
IsDisposed
Gets a value indicating whether this producer has been disposed and is no longer usable.
Declaration
bool IsDisposed { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsRunning
Gets a value indicating whether the producer is currently running and able to send messages.
Declaration
bool IsRunning { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Tag
Gets a unique identifier for this producer instance. Useful for diagnostics and logging.
Declaration
Guid Tag { get; }
Property Value
| Type | Description |
|---|---|
| Guid |
Methods
CommitAsync()
Commits the current transaction, if the producer is operating in a transactional mode.
Declaration
Task CommitAsync()
Returns
| Type | Description |
|---|---|
| Task | A task that completes when the commit operation has finished. |
RollbackAsync()
Rolls back the current transaction, if the producer is operating in a transactional mode.
Declaration
Task RollbackAsync()
Returns
| Type | Description |
|---|---|
| Task | A task that completes when the rollback operation has finished. |
SendMessageAsync(IMessage)
Sends a message using the producer's default destination and delivery settings.
Declaration
Task SendMessageAsync(IMessage message)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | message | The message to send. |
Returns
| Type | Description |
|---|---|
| Task | A task that completes when the send operation has finished. |
SendMessageAsync(IMessage, IDestination)
Sends a message to a specific destination instance.
Declaration
Task SendMessageAsync(IMessage message, IDestination destination)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | message | The message to send. |
| IDestination | destination | The destination to send the message to. |
Returns
| Type | Description |
|---|---|
| Task | A task that completes when the send operation has finished. |
SendMessageAsync(IMessage, IDestination, MsgDeliveryMode, MsgPriority, TimeSpan)
Sends a message to a specific destination instance with explicit delivery settings.
Declaration
Task SendMessageAsync(IMessage message, IDestination destination, MsgDeliveryMode deliveryMode, MsgPriority priority, TimeSpan timeToLive)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | message | The message to send. |
| IDestination | destination | The destination to send the message to. |
| MsgDeliveryMode | deliveryMode | The delivery mode to use for the message. |
| MsgPriority | priority | The priority to use for the message. |
| TimeSpan | timeToLive | The time-to-live for the message. |
Returns
| Type | Description |
|---|---|
| Task | A task that completes when the send operation has finished. |
SendMessageAsync(IMessage, MsgDeliveryMode, MsgPriority, TimeSpan)
Sends a message with explicit delivery mode, priority, and time-to-live settings.
Declaration
Task SendMessageAsync(IMessage message, MsgDeliveryMode deliveryMode, MsgPriority priority, TimeSpan timeToLive)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | message | The message to send. |
| MsgDeliveryMode | deliveryMode | The delivery mode to use for the message. |
| MsgPriority | priority | The priority to use for the message. |
| TimeSpan | timeToLive | The time-to-live for the message. |
Returns
| Type | Description |
|---|---|
| Task | A task that completes when the send operation has finished. |
SendMessageAsync(IMessage, string, DestinationType)
Sends a message to a destination identified by name and type (queue or topic).
Declaration
Task SendMessageAsync(IMessage message, string destinationName, DestinationType destinationType)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | message | The message to send. |
| string | destinationName | The name of the destination (queue or topic). |
| DestinationType | destinationType | The type of the destination. |
Returns
| Type | Description |
|---|---|
| Task | A task that completes when the send operation has finished. |
SendMessageAsync(IMessage, string, DestinationType, MsgDeliveryMode, MsgPriority, TimeSpan)
Sends a message to a destination identified by name and type using explicit delivery settings.
Declaration
Task SendMessageAsync(IMessage message, string destinationName, DestinationType destinationType, MsgDeliveryMode deliveryMode, MsgPriority priority, TimeSpan timeToLive)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | message | The message to send. |
| string | destinationName | The name of the destination (queue or topic). |
| DestinationType | destinationType | The type of the destination. |
| MsgDeliveryMode | deliveryMode | The delivery mode to use for the message. |
| MsgPriority | priority | The priority to use for the message. |
| TimeSpan | timeToLive | The time-to-live for the message. |
Returns
| Type | Description |
|---|---|
| Task | A task that completes when the send operation has finished. |