Interface IChaparBus
Primary abstraction for sending events and commands onto the message bus.
Namespace: Chapar.Core.Abstractions
Assembly: Chapar.Core.dll
Syntax
public interface IChaparBus
Methods
| Edit this page View SourcePublishAsync<TEvent>(TEvent, IDictionary<string, object>?, CancellationToken)
Publishes an event to all interested subscribers (fan‑out).
Declaration
Task PublishAsync<TEvent>(TEvent @event, IDictionary<string, object>? headers = null, CancellationToken cancellationToken = default) where TEvent : class, IEvent
Parameters
| Type | Name | Description |
|---|---|---|
| TEvent | event | The event payload. |
| IDictionary<string, object> | headers | Optional headers that will be attached to the outgoing message. |
| CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task |
Type Parameters
| Name | Description |
|---|---|
| TEvent | The type of the event message (must implement IEvent). |
SendAsync<TCommand>(TCommand, string, IDictionary<string, object>?, CancellationToken)
Sends a command directly to the specified queue (point‑to‑point).
Declaration
Task SendAsync<TCommand>(TCommand command, string queueName, IDictionary<string, object>? headers = null, CancellationToken cancellationToken = default) where TCommand : class, ICommand
Parameters
| Type | Name | Description |
|---|---|---|
| TCommand | command | The command payload. |
| string | queueName | The name of the destination queue. |
| IDictionary<string, object> | headers | Optional headers that will be attached to the outgoing message. |
| CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task |
Type Parameters
| Name | Description |
|---|---|
| TCommand | The type of the command message (must implement ICommand). |