RabbitMqCommandQueue Class
Definition
- Namespace
- Savvyio.Extensions.RabbitMQ.Commands
- Assemblies
- Savvyio.Extensions.RabbitMQ.dll
Provides a default implementation of the RabbitMqMessage class for messages holding an ICommand implementation.
public class RabbitMqCommandQueue : RabbitMqMessage, IDisposable, IAsyncDisposable, IAsyncHealthCheckProvider<IConnection>, IPointToPointChannel<ICommand>, ISender<ICommand>, IReceiver<ICommand>
- Inheritance
-
objectRabbitMqCommandQueue
- Implements
-
IAsyncHealthCheckProvider<IConnection>
- Derived
- Inherited Members
Examples
RabbitMqCommandQueue publishes and receives commands through RabbitMQ. Configure it with RabbitMqCommandQueueOptions and use it as IPointToPointChannel<ICommand>.
using System;
using Savvyio.Commands;
using Savvyio.Extensions.RabbitMQ.Commands;
using Savvyio.Messaging;
namespace ExampleApp;
public class RabbitMqCommandQueueConfig
{
public static RabbitMqCommandQueueOptions CreateOptions()
{
return new RabbitMqCommandQueueOptions { AmqpUrl = new Uri("amqp://guest:guest@localhost:5672"), QueueName = "account-commands", Durable = true };
}
public static IPointToPointChannel<ICommand> AsChannel(RabbitMqCommandQueue queue) => queue;
}
Constructors
| Name | Description |
|---|---|
| RabbitMqCommandQueue(IMarshaller, RabbitMqCommandQueueOptions) | Initializes a new instance of the RabbitMqCommandQueue class. |
Methods
| Name | Description |
|---|---|
| ReceiveAsync(Action<AsyncOptions>) | Receives command messages asynchronously from the configured RabbitMQ queue. |
| SendAsync(IEnumerable<IMessage<ICommand>>, Action<AsyncOptions>) | Sends the specified command messages asynchronously to the configured RabbitMQ queue. |
See Also
IPointToPointChannel<TRequest>