zeebe-redis-connector 0.9.11

dotnet add package zeebe-redis-connector --version 0.9.11
NuGet\Install-Package zeebe-redis-connector -Version 0.9.11
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="zeebe-redis-connector" Version="0.9.11" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add zeebe-redis-connector --version 0.9.11
#r "nuget: zeebe-redis-connector, 0.9.11"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install zeebe-redis-connector as a Cake Addin
#addin nuget:?package=zeebe-redis-connector&version=0.9.11

// Install zeebe-redis-connector as a Cake Tool
#tool nuget:?package=zeebe-redis-connector&version=0.9.11

C# Zeebe Redis Connector

This library enables the retrieval of Zeebe events with C#. It is based on StackExchange.Redis and requires the configuration of the Zeebe Exporter as described in the main project on Camunda Community Hub (camunda-community-hub/zeebe-redis-exporter).

Current limitations:

  • The connector uses a Multi-key operation to receive events from Redis and thus does not yet work with Redis Clusters.
  • StackExchange.Redis does not yet support blocking operations - hence this library is forced to use polling.
  • It is - not yet - possible to configure a stream prefix other than the default. For now this is hardwired to zeebe:.

Requirements

Usage

The Zeebe Redis Connector extension is available via nuget (https://www.nuget.org/packages/zeebe-redis-connector/).

Bootstrap

The library provides an extension IServiceCollection.AddZeebeRedis(...) for hosted services in order to bootstrap the connector. It requires ZeebeRedisOptions.

You can either wire your options manually

ConfigureServices((hostContext, services) => {
    services.AddZeebeRedis(options => {
        options.RedisConfigString = "localhost";
        options.RedisConsumerGroup = "my-consumer-group";
        options.RedisPollIntervallMillis = 500;
    })
    .AddSingleton<ZeebeRedisListener>();
})

or use a corresponding configuration section

ConfigureServices((hostContext, services) => {
    services.AddZeebeRedis(
        hostContext.Configuration.GetSection("ZeebeRedisConfiguration")
    })
    .AddSingleton<ZeebeRedisListener>();
})

with

{
  "ZeebeRedisConfiguration": {
    "RedisConfigString": "localhost",
    "RedisConsumerGroup": "my-csharp-consumer",
    "RedisPollIntervallMillis" : 500
  }
}

Lastly, it is also possible to use environment variables:

ConfigureServices((hostContext, services) => {
    services.AddZeebeRedis()
    .AddSingleton<ZeebeRedisListener>();
})
Environment Parameter Description
REDIS_CONFIG_STRING Redis URL as required by StackExchange.Redis. Default: localhost
REDIS_CONSUMER_GROUP The consumer group. Default: empty
REDIS_POLL_INTERVALL_MILLIS Poll interval in milliseconds. Default: 500

Environment variables always have precedence over other ways of configuration.

Hint: It is strongly recommended to set the consumer group name. Otherwise, you will get a unique disposable group generated at startup.

Registering Zeebe Event Listeners

By injecting ZeebeRedis in one of your services you're able to register listeners for specific events. Registering listeners should happen before the startup of your application e.g. in the constructor.

public class ZeebeRedisListener
{
    public ZeebeRedisListener(ZeebeRedis zeebeRedis) {
        zeebeRedis
            .AddDeploymentListener((deployment) => ReceiveDeploymentRecord(deployment))
            .AddIncidentListener((incident) => ...)
            .AddJobListener((job) => ...)
            ...
            ;
    }

    private void ReceiveDeploymentRecord(DeploymentRecord deploymentRecord)
    {
        ...
    }
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.9.11 120 2/29/2024