RabbitMqMessage Class
Definition
- Namespace
- Savvyio.Extensions.RabbitMQ
- Assemblies
- Savvyio.Extensions.RabbitMQ.dll
Provides a base class for RabbitMQ message operations, including connection and channel management, marshalling, and resource disposal. Ensures thread-safe initialization of RabbitMQ connectivity.
public abstract class RabbitMqMessage : AsyncDisposable, IDisposable, IAsyncDisposable, IAsyncHealthCheckProvider<IConnection>
- Inheritance
-
objectRabbitMqMessage
- Implements
-
IAsyncHealthCheckProvider<IConnection>
- Derived
- Inherited Members
Constructors
| Name | Description |
|---|---|
| RabbitMqMessage(IMarshaller, RabbitMqMessageOptions) | Initializes a new instance of the RabbitMqMessage class with the specified marshaller and options. |
Fields
| Name | Description |
|---|---|
| MessageType | The header key used to indicate the message type in RabbitMQ properties. |
Properties
| Name | Description |
|---|---|
| Marshaller | Gets the by constructor provided serializer context. |
| RabbitMqChannel | Gets the current RabbitMQ channel instance. |
| RabbitMqConnection | Gets the current RabbitMQ connection instance. |
| RabbitMqFactory | Gets the RabbitMQ connection factory used to create connections to the broker. |
Methods
| Name | Description |
|---|---|
| EnsureConnectivityAsync(CancellationToken) | Ensures that a connection and channel to the RabbitMQ broker are established and initialized. This method is thread-safe and will only initialize the connection and channel once. |
| GetHealthCheckTargetAsync(CancellationToken) | Asynchronously returns an RabbitMQ.Client.IConnection instance used for probing the health status of the RabbitMQ broker. |
| OnDisposeManagedResourcesAsync() | Called when this object is being disposed by DisposeAsync(). Disposes the RabbitMQ channel and connection asynchronously if they have been initialized. |