Class InMemoryEventBus
- Namespace
- Savvyio.EventDriven.Messaging
- Assembly
- Savvyio.EventDriven.Messaging.dll
Provides an in-memory implementation of the IPublishSubscribeChannel<TRequest> interface useful for unit testing and the likes thereof.
public class InMemoryEventBus : IPublishSubscribeChannel<IIntegrationEvent>, IPublisher<IIntegrationEvent>, ISubscriber<IIntegrationEvent>
- Inheritance
-
ObjectInMemoryEventBus
- Implements
Methods
PublishAsync(IMessage<IIntegrationEvent>, Action<AsyncOptions>)
Publishes the specified event
asynchronous using Publish-Subscribe Channel/Pub-Sub MEP.
public async Task PublishAsync(IMessage<IIntegrationEvent> event, Action<AsyncOptions> setup = null)
Parameters
event
IMessage<IIntegrationEvent>The IIntegrationEvent to publish.
setup
Action<AsyncOptions>The AsyncOptions which may be configured.
Returns
- Task
A System.Threading.Tasks.Task that represents the asynchronous operation.
SubscribeAsync(Func<IMessage<IIntegrationEvent>, CancellationToken, Task>, Action<SubscribeAsyncOptions>)
Subscribe to one or more event(s) asynchronous using Publish-Subscribe Channel/Pub-Sub MEP.
public async Task SubscribeAsync(Func<IMessage<IIntegrationEvent>, CancellationToken, Task> asyncHandler, Action<SubscribeAsyncOptions> setup = null)
Parameters
asyncHandler
Func<IMessage<IIntegrationEvent>, CancellationToken, Task>The delegate that will handle the event.
setup
Action<SubscribeAsyncOptions>The SubscribeAsyncOptions which may be configured.
Returns
- Task
A System.Threading.Tasks.Task that represents the asynchronous operation.