StellaOps.Workflow.Signaling.Redis

Redis signal driver for the workflow engine: delivers wake messages when signals are stored.

library
Component
Workflow
Licence
BUSL-1.1 (Workflow licence)
Target framework
net10.0
Latest release
1.0.1-20261118T121708Z

Install

dotnet add package StellaOps.Workflow.Signaling.Redis --version 1.0.1-20261118T121708Z

Namespaces

NamespaceTypes
StellaOps.Workflow.Signaling.Redis7

namespace StellaOps.Workflow.Signaling.Redis

TypeKindDescription
RedisWorkflowSignalDriverclassThe Redis signal driver: it publishes a wake message on a Redis channel after the workflow changes commit, and claims the signals from the durable store when a wake arrives or the blocking wait ends.
RedisWorkflowSignalDriverOptionsclassSettings of the Redis signal driver (WorkflowSignalDriver:Redis).
RedisWorkflowSignalingExtensionsclassRegisters the Redis signal driver.
RedisWorkflowSignalingRoutineclassDependency-injection routine of the Redis signal driver.
RedisWorkflowWakeMessageSerializerclassWrites and reads the wake messages of the Redis channel.
RedisWorkflowWakeSubscriptionclassThe subscription to the Redis wake channel.
WorkflowRedisHealthCheckclassReports whether the Redis wake signaling is connected.

class RedisWorkflowSignalDriver

public sealed class RedisWorkflowSignalDriver : IWorkflowSignalDriver

The Redis signal driver: it publishes a wake message on a Redis channel after the workflow changes commit, and claims the signals from the durable store when a wake arrives or the blocking wait ends.

Parameters

  • connectionMultiplexer: The Redis connection.
  • signalClaimStore: Claims the stored signals.
  • wakeSubscription: Receives the wake messages.
  • driverOptions: The channel name and the blocking wait.

Members

MemberKindSummary
RedisWorkflowSignalDriver(IConnectionMultiplexer, IWorkflowSignalClaimStore, RedisWorkflowWakeSubscription, IOptions<RedisWorkflowSignalDriverOptions>)constructorThe Redis signal driver: it publishes a wake message on a Redis channel after the workflow changes commit, and claims the signals from the durable store when a wake arrives or the blocking wait ends.
DispatchModepropertyWhen the engine tells the driver that a signal is available.
DriverNamepropertyThe driver name, as WorkflowSignalDriver:Provider selects it.
NotifySignalAvailableAsync(WorkflowSignalWakeNotification, CancellationToken)methodTells the consumers that a signal is available.
ReceiveAsync(string, CancellationToken)methodWaits up to the driver’s blocking wait for a signal to claim.

constructor RedisWorkflowSignalDriver(IConnectionMultiplexer, IWorkflowSignalClaimStore, RedisWorkflowWakeSubscription, IOptions<RedisWorkflowSignalDriverOptions>) #

public RedisWorkflowSignalDriver(IConnectionMultiplexer connectionMultiplexer, IWorkflowSignalClaimStore signalClaimStore, RedisWorkflowWakeSubscription wakeSubscription, IOptions<RedisWorkflowSignalDriverOptions> driverOptions)

The Redis signal driver: it publishes a wake message on a Redis channel after the workflow changes commit, and claims the signals from the durable store when a wake arrives or the blocking wait ends.

Parameters

  • connectionMultiplexer: The Redis connection.
  • signalClaimStore: Claims the stored signals.
  • wakeSubscription: Receives the wake messages.
  • driverOptions: The channel name and the blocking wait.

property DispatchMode #

public WorkflowSignalDriverDispatchMode DispatchMode { get; }

When the engine tells the driver that a signal is available.

property DriverName #

public string DriverName { get; }

The driver name, as WorkflowSignalDriver:Provider selects it.

method NotifySignalAvailableAsync(WorkflowSignalWakeNotification, CancellationToken) #

public Task NotifySignalAvailableAsync(WorkflowSignalWakeNotification notification, CancellationToken cancellationToken = default)

Tells the consumers that a signal is available.

Parameters

  • notification: The available signal.
  • cancellationToken: Cancels the operation.

Returns

A task that completes when the notification is sent.

method ReceiveAsync(string, CancellationToken) #

public Task<IWorkflowSignalLease?> ReceiveAsync(string consumerName, CancellationToken cancellationToken = default)

Waits up to the driver’s blocking wait for a signal to claim.

Parameters

  • consumerName: The consumer.
  • cancellationToken: Cancels the operation.

Returns

The lease of the claimed signal, or null when none arrives in time.

class RedisWorkflowSignalDriverOptions

public sealed class RedisWorkflowSignalDriverOptions

Settings of the Redis signal driver (WorkflowSignalDriver:Redis).

Members

MemberKindSummary
RedisWorkflowSignalDriverOptions()constructorCreates an instance of RedisWorkflowSignalDriverOptions.
SectionNameconstantThe configuration section the options bind from: WorkflowSignalDriver:Redis.
BlockingWaitSecondspropertyHow long a receive waits for a signal before it returns empty, in seconds; a value below 1 counts as 1.
ChannelNamepropertyThe Redis channel that announces new signals.

constructor RedisWorkflowSignalDriverOptions() #

public RedisWorkflowSignalDriverOptions()

Creates an instance of RedisWorkflowSignalDriverOptions.

constant SectionName #

public const string SectionName = "WorkflowSignalDriver:Redis"

The configuration section the options bind from: WorkflowSignalDriver:Redis.

property BlockingWaitSeconds #

public int BlockingWaitSeconds { get; set; }

How long a receive waits for a signal before it returns empty, in seconds; a value below 1 counts as 1. The default is 30.

property ChannelName #

public string ChannelName { get; set; }

The Redis channel that announces new signals. The default is stellaops:workflow:signals.

class RedisWorkflowSignalingExtensions

public static class RedisWorkflowSignalingExtensions

Registers the Redis signal driver.

Members

MemberKindSummary
AddWorkflowRedisSignaling(IServiceCollection, IConfiguration)extension methodRegisters the Redis signal driver, bound from WorkflowSignalDriver:Redis, when WorkflowSignalDriver:Provider is Redis; otherwise it only records the driver module.

extension method AddWorkflowRedisSignaling(IServiceCollection, IConfiguration) #

public static IServiceCollection AddWorkflowRedisSignaling(this IServiceCollection services, IConfiguration configuration)

Registers the Redis signal driver, bound from WorkflowSignalDriver:Redis, when WorkflowSignalDriver:Provider is Redis; otherwise it only records the driver module.

Parameters

  • services: The service collection to add the services to.
  • configuration: The host configuration.

Returns

The same service collection, for chaining.

class RedisWorkflowSignalingRoutine

public sealed class RedisWorkflowSignalingRoutine : IDependencyInjectionRoutine

Dependency-injection routine of the Redis signal driver. A host that loads this assembly as a plugin discovers the routine; it registers exactly what RedisWorkflowSignalingExtensions.AddWorkflowRedisSignaling(IServiceCollection, IConfiguration)registers. The host still provides the IConnectionMultiplexer, as it does for a package reference.

Members

MemberKindSummary
RedisWorkflowSignalingRoutine()constructorCreates an instance of RedisWorkflowSignalingRoutine.
Register(IServiceCollection, IConfiguration)methodRegisters what RedisWorkflowSignalingExtensions.AddWorkflowRedisSignaling(IServiceCollection, IConfiguration)registers.

constructor RedisWorkflowSignalingRoutine() #

public RedisWorkflowSignalingRoutine()

Creates an instance of RedisWorkflowSignalingRoutine.

method Register(IServiceCollection, IConfiguration) #

public IServiceCollection Register(IServiceCollection services, IConfiguration configuration)

Registers what RedisWorkflowSignalingExtensions.AddWorkflowRedisSignaling(IServiceCollection, IConfiguration)registers.

Parameters

  • services: The service collection.
  • configuration: The host configuration.

Returns

The same service collection.

class RedisWorkflowWakeMessageSerializer

public static class RedisWorkflowWakeMessageSerializer

Writes and reads the wake messages of the Redis channel.

Members

MemberKindSummary
Deserialize(string)methodReads a wake notification from JSON.
Serialize(WorkflowSignalWakeNotification)methodWrites a wake notification as JSON.

method Deserialize(string) #

public static WorkflowSignalWakeNotification Deserialize(string payload)

Reads a wake notification from JSON.

Parameters

  • payload: The JSON message.

Returns

The notification.

Exceptions

  • InvalidOperationException: The message is JSON null.

method Serialize(WorkflowSignalWakeNotification) #

public static string Serialize(WorkflowSignalWakeNotification notification)

Writes a wake notification as JSON.

Parameters

  • notification: The notification.

Returns

The JSON message.

class RedisWorkflowWakeSubscription

public sealed class RedisWorkflowWakeSubscription : IDisposable, IAsyncDisposable

The subscription to the Redis wake channel.

Parameters

  • connectionMultiplexer: The Redis connection.
  • driverOptions: The channel name.

Members

MemberKindSummary
RedisWorkflowWakeSubscription(IConnectionMultiplexer, IOptions<RedisWorkflowSignalDriverOptions>)constructorThe subscription to the Redis wake channel.
Dispose()methodUnsubscribes from the channel.
DisposeAsync()methodUnsubscribes from the channel.
WaitForNotificationAsync(TimeSpan, CancellationToken)methodWaits for the next wake message, subscribing to the channel on first use.

constructor RedisWorkflowWakeSubscription(IConnectionMultiplexer, IOptions<RedisWorkflowSignalDriverOptions>) #

public RedisWorkflowWakeSubscription(IConnectionMultiplexer connectionMultiplexer, IOptions<RedisWorkflowSignalDriverOptions> driverOptions)

The subscription to the Redis wake channel.

Parameters

  • connectionMultiplexer: The Redis connection.
  • driverOptions: The channel name.

method Dispose() #

public void Dispose()

Unsubscribes from the channel.

method DisposeAsync() #

public ValueTask DisposeAsync()

Unsubscribes from the channel.

Returns

A task that completes when the subscription is closed.

method WaitForNotificationAsync(TimeSpan, CancellationToken) #

public Task<WorkflowSignalWakeNotification?> WaitForNotificationAsync(TimeSpan maxWait, CancellationToken cancellationToken = default)

Waits for the next wake message, subscribing to the channel on first use.

Parameters

  • maxWait: How long to wait.
  • cancellationToken: Cancels the operation.

Returns

The notification, or null when none arrives in time.

class WorkflowRedisHealthCheck

public sealed class WorkflowRedisHealthCheck : IHealthCheck

Reports whether the Redis wake signaling is connected.

Parameters

  • connectionMultiplexer: The Redis connection.

Members

MemberKindSummary
WorkflowRedisHealthCheck(IConnectionMultiplexer)constructorReports whether the Redis wake signaling is connected.
CheckHealthAsync(HealthCheckContext, CancellationToken)methodPings Redis: healthy with the latency when connected, unhealthy otherwise.

constructor WorkflowRedisHealthCheck(IConnectionMultiplexer) #

public WorkflowRedisHealthCheck(IConnectionMultiplexer connectionMultiplexer)

Reports whether the Redis wake signaling is connected.

Parameters

  • connectionMultiplexer: The Redis connection.

method CheckHealthAsync(HealthCheckContext, CancellationToken) #

public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)

Pings Redis: healthy with the latency when connected, unhealthy otherwise.

Parameters

  • context: The health check context.
  • cancellationToken: Cancels the operation.

Returns

The health check result.