Class InProcessEventBus
In-process event bus backed by Channel<T>. Suitable for single-process gateway; replace with a distributed implementation (Redis Pub/Sub, Azure Service Bus, etc.) for multi-node.
public sealed class InProcessEventBus : IEventBus, IDisposable
- Inheritance
-
InProcessEventBus
- Implements
- Inherited Members
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
PublishAsync(GatewayEvent, CancellationToken)
Publishes an event to all subscribers.
public Task PublishAsync(GatewayEvent evt, CancellationToken ct = default)
Parameters
evtGatewayEventctCancellationToken
Returns
StreamAsync(string?, CancellationToken)
Returns an async enumerable of events for streaming scenarios.
public IAsyncEnumerable<GatewayEvent> StreamAsync(string? eventTypeFilter, CancellationToken ct = default)
Parameters
eventTypeFilterstringctCancellationToken
Returns
Subscribe(string?, Func<GatewayEvent, Task>)
Subscribes to events matching the given filter.
public IDisposable Subscribe(string? eventTypeFilter, Func<GatewayEvent, Task> handler)
Parameters
eventTypeFilterstringhandlerFunc<GatewayEvent, Task>