Interface IMessageBusAdapterLifecycle
Sub-interface for message bus adapter lifecycle operations including start, stop, and health checking.
public interface IMessageBusAdapterLifecycle
- Extension Methods
Remarks
This interface separates lifecycle concerns from core messaging operations defined in IMessageBusAdapter. Implementations that support managed lifecycle (start/stop) and health monitoring should implement this interface in addition to IMessageBusAdapter.
Consumers that only need to publish or subscribe to messages can depend on IMessageBusAdapter alone, while infrastructure code that manages adapter lifecycle (such as hosted services) can resolve IMessageBusAdapterLifecycle when needed.
Methods
CheckHealthAsync(CancellationToken)
Performs a health check on the message bus adapter.
Task<HealthCheckResult> CheckHealthAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenToken to cancel the health check operation.
Returns
- Task<HealthCheckResult>
A task containing the health check result.
InitializeAsync(MessageBusOptions, CancellationToken)
Initializes the message bus adapter with the specified configuration.
Task InitializeAsync(MessageBusOptions options, CancellationToken cancellationToken)
Parameters
optionsMessageBusOptionsConfiguration options for the adapter.
cancellationTokenCancellationTokenToken to cancel the initialization operation.
Returns
- Task
A task representing the initialization operation.
StartAsync(CancellationToken)
Starts the message bus adapter and begins processing operations.
Task StartAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenToken to cancel the start operation.
Returns
- Task
A task representing the start operation.
StopAsync(CancellationToken)
Stops the message bus adapter and ceases all operations.
Task StopAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenToken to cancel the stop operation.
Returns
- Task
A task representing the stop operation.