Table of Contents

SubscribeAsync Method

Definition

Namespace
Savvyio.Extensions.NATS.EventDriven
Assemblies
Savvyio.Extensions.NATS.dll
Source
src/Savvyio.Extensions.NATS/EventDriven/NatsEventBus.cs

SubscribeAsync(Func<IMessage<IIntegrationEvent>, CancellationToken, Task>, Action<SubscribeAsyncOptions>)

Subscribes to integration event messages from the configured NATS subject and invokes the specified asynchronous handler for each received message.

public Task SubscribeAsync(Func<IMessage<IIntegrationEvent>, CancellationToken, Task> asyncHandler, Action<SubscribeAsyncOptions> setup = null)

Parameters

asyncHandler Func<IMessage<IIntegrationEvent>, CancellationToken, Task>

The function delegate that will handle the message.

setup Action<SubscribeAsyncOptions>

The SubscribeAsyncOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.