From 617d2006c307c57da067b83688520162e54e0afe Mon Sep 17 00:00:00 2001 From: Gunnar von der Beck Date: Wed, 28 Feb 2024 08:50:04 +0100 Subject: [PATCH] refactor: adjust some namespaces in connector-csharp --- .github/workflows/build.yml | 20 +++++++++++++++++++ .github/workflows/deploy.yml | 1 + .../HostedServiceTest.cs | 2 +- .../zeebe-redis-connector/ZeebeRedis.cs | 9 +++++---- .../ZeebeRedisOptions.cs | 8 +++++--- .../DeploymentDistributionRecordConsumer.cs | 9 +++++---- .../consumer/DeploymentRecordConsumer.cs | 9 +++++---- .../consumer/ErrorRecordConsumer.cs | 9 +++++---- .../consumer/IRecordConsumer.cs | 2 +- .../consumer/IncidentRecordConsumer.cs | 9 +++++---- .../consumer/JobBatchRecordConsumer.cs | 9 +++++---- .../consumer/JobRecordConsumer.cs | 9 +++++---- .../consumer/MessageRecordConsumer.cs | 9 +++++---- ...ageStartEventSubscriptionRecordConsumer.cs | 9 +++++---- .../MessageSubscriptionRecordConsumer.cs | 9 +++++---- .../consumer/ProcessEventRecordConsumer.cs | 9 +++++---- .../ProcessInstanceCreationRecordConsumer.cs | 9 +++++---- .../consumer/ProcessInstanceRecordConsumer.cs | 9 +++++---- ...ocessMesssageSubscriptionRecordConsumer.cs | 9 +++++---- .../consumer/ProcessRecordConsumer.cs | 9 +++++---- .../consumer/TimerRecordConsumer.cs | 9 +++++---- .../VariableDocumentRecordConsumer.cs | 9 +++++---- .../consumer/VariableRecordConsumer.cs | 9 +++++---- .../ServiceCollectionExtensions.cs | 3 +-- .../ZeebeRedisHostedService.cs | 13 ++++++------ 25 files changed, 125 insertions(+), 86 deletions(-) rename connector-csharp/zeebe-redis-connector/{hostedservice => hosting}/ServiceCollectionExtensions.cs (95%) rename connector-csharp/zeebe-redis-connector/{hostedservice => hosting}/ZeebeRedisHostedService.cs (76%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 07f096d..9b872b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,7 @@ on: jobs: build: + name: Build Java runs-on: ubuntu-latest steps: - name: Checkout @@ -26,3 +27,22 @@ jobs: - name: Run Maven run: mvn -B clean verify com.mycila:license-maven-plugin:check + build-net: + name: Build .NET + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Pull Zeebe + run: docker pull ghcr.io/camunda-community-hub/zeebe-with-redis-exporter:latest + - name: Pull Redis + run: docker pull redis:7-alpine + - name: Checkout + uses: actions/checkout@v4 + - name: Setup + uses: actions/setup-dotnet@v4.0.0 + with: + dotnet-version: 8.x + - name: Build + run: dotnet build --configuration Release + - name: Test + run: dotnet test --configuration Release --no-build diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cd8e6fd..ce753b0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,6 +11,7 @@ on: - 'main' paths-ignore: - 'README.md' + - 'connector-csharp/**' release: types: [published] jobs: diff --git a/connector-csharp/zeebe-redis-connector-test/HostedServiceTest.cs b/connector-csharp/zeebe-redis-connector-test/HostedServiceTest.cs index ab960df..141da4d 100644 --- a/connector-csharp/zeebe-redis-connector-test/HostedServiceTest.cs +++ b/connector-csharp/zeebe-redis-connector-test/HostedServiceTest.cs @@ -12,8 +12,8 @@ using Io.Zeebe.Exporter.Proto; using Microsoft.Extensions.DependencyInjection; using Io.Zeebe.Redis.Connect.Csharp; -using NLog.Extensions.Hosting; using Io.Zeebe.Redis.Connect.Csharp.Hosting; +using NLog.Extensions.Hosting; using static PleaseWait.Dsl; using static PleaseWait.TimeUnit; diff --git a/connector-csharp/zeebe-redis-connector/ZeebeRedis.cs b/connector-csharp/zeebe-redis-connector/ZeebeRedis.cs index fea7591..2e883f7 100644 --- a/connector-csharp/zeebe-redis-connector/ZeebeRedis.cs +++ b/connector-csharp/zeebe-redis-connector/ZeebeRedis.cs @@ -1,4 +1,5 @@ using Io.Zeebe.Exporter.Proto; +using Io.Zeebe.Redis.Connect.Csharp.Consumer; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using StackExchange.Redis; @@ -7,8 +8,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using zeebe_redis_connector; -using zeebe_redis_connector.consumer; namespace Io.Zeebe.Redis.Connect.Csharp { @@ -17,7 +16,7 @@ public class ZeebeRedis private readonly ILogger? _logger; private CancellationTokenSource? _cancellationTokenSource = null; private readonly ConnectionMultiplexer _redisConnection; - private readonly String _consumerGroup; + private readonly string _consumerGroup; private readonly bool _deleteConsumerGroupOnDispose = false; private readonly IDatabase _database; private readonly List _streamPositions = new List(); @@ -31,7 +30,7 @@ public class ZeebeRedis // Constructors //--------------------------------------------------------------------- - public ZeebeRedis(ConnectionMultiplexer redisConnection, String? consumerGroup = null, ILoggerFactory? loggerFactory = null, int pollIntervalMillis = 500, bool closeRedisConnectionOnDispose = false) + public ZeebeRedis(ConnectionMultiplexer redisConnection, string? consumerGroup = null, ILoggerFactory? loggerFactory = null, int pollIntervalMillis = 500, bool closeRedisConnectionOnDispose = false) { _redisConnection = redisConnection ?? throw new ArgumentNullException(nameof(redisConnection)); _consumerGroup = consumerGroup ?? Guid.NewGuid().ToString(); @@ -247,8 +246,10 @@ public async Task StartConsumeEvents(CancellationTokenSource? cancellationTokenS id = entry.Id; var record = Record.Parser.ParseFrom(entry.Values.First().Value); +#pragma warning disable CS8600, CS8602 _consumer.TryGetValue(result.Key, out IRecordConsumer consumer); consumer.Consume(record); +#pragma warning restore CS8600, CS8602 if (!string.IsNullOrEmpty(id)) { _database.StreamAcknowledge(result.Key, _consumerGroup, id); diff --git a/connector-csharp/zeebe-redis-connector/ZeebeRedisOptions.cs b/connector-csharp/zeebe-redis-connector/ZeebeRedisOptions.cs index d6db8be..553d59e 100644 --- a/connector-csharp/zeebe-redis-connector/ZeebeRedisOptions.cs +++ b/connector-csharp/zeebe-redis-connector/ZeebeRedisOptions.cs @@ -14,12 +14,14 @@ public class ZeebeRedisOptions private string _redisConfigString = "localhost"; public virtual string RedisConfigString { +#pragma warning disable CS8603 // Possible null reference return. get { return GetEnvironmentVariable("REDIS_CONFIG_STRING", _redisConfigString); } +#pragma warning restore CS8603 // Possible null reference return. set { _redisConfigString = value; } } - private string _redisConsumerGroup = Guid.NewGuid().ToString(); - public virtual string RedisConsumerGroup + private string? _redisConsumerGroup = null; + public virtual string? RedisConsumerGroup { get { return GetEnvironmentVariable("REDIS_CONSUMER_GROUP", _redisConsumerGroup); } set { _redisConsumerGroup = value; } @@ -39,7 +41,7 @@ public bool Validate() return true; } - public static string GetEnvironmentVariable(string name, string defaultValue) + public static string? GetEnvironmentVariable(string name, string? defaultValue) => Environment.GetEnvironmentVariable(name) is string v && v.Length > 0 ? v : defaultValue; public static int GetEnvironmentVariable(string name, int defaultValue) diff --git a/connector-csharp/zeebe-redis-connector/consumer/DeploymentDistributionRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/DeploymentDistributionRecordConsumer.cs index b0e7640..0f9c64f 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/DeploymentDistributionRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/DeploymentDistributionRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class DeploymentDistributionRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:DEPLOYMENT_DISTRIBUTION"; + public static string STREAM = "zeebe:DEPLOYMENT_DISTRIBUTION"; private readonly Action _consumer; - public DeploymentDistributionRecordConsumer(Action action) { - this._consumer = action; + public DeploymentDistributionRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/DeploymentRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/DeploymentRecordConsumer.cs index 8d29cd4..7b0ccee 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/DeploymentRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/DeploymentRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class DeploymentRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:DEPLOYMENT"; + public static string STREAM = "zeebe:DEPLOYMENT"; private readonly Action _consumer; - public DeploymentRecordConsumer(Action action) { - this._consumer = action; + public DeploymentRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/ErrorRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/ErrorRecordConsumer.cs index 15732d3..ed42681 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/ErrorRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/ErrorRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class ErrorRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:ERROR"; + public static string STREAM = "zeebe:ERROR"; private readonly Action _consumer; - public ErrorRecordConsumer(Action action) { - this._consumer = action; + public ErrorRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/IRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/IRecordConsumer.cs index 03ef3e3..ec1a613 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/IRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/IRecordConsumer.cs @@ -1,6 +1,6 @@ using Io.Zeebe.Exporter.Proto; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public interface IRecordConsumer { diff --git a/connector-csharp/zeebe-redis-connector/consumer/IncidentRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/IncidentRecordConsumer.cs index 4597dae..458009b 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/IncidentRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/IncidentRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class IncidentRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:INCIDENT"; + public static string STREAM = "zeebe:INCIDENT"; private readonly Action _consumer; - public IncidentRecordConsumer(Action action) { - this._consumer = action; + public IncidentRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/JobBatchRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/JobBatchRecordConsumer.cs index 842b432..f47113b 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/JobBatchRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/JobBatchRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class JobBatchRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:JOB_BATCH"; + public static string STREAM = "zeebe:JOB_BATCH"; private readonly Action _consumer; - public JobBatchRecordConsumer(Action action) { - this._consumer = action; + public JobBatchRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/JobRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/JobRecordConsumer.cs index b4ce0a3..aa524be 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/JobRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/JobRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class JobRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:JOB"; + public static string STREAM = "zeebe:JOB"; private readonly Action _consumer; - public JobRecordConsumer(Action action) { - this._consumer = action; + public JobRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/MessageRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/MessageRecordConsumer.cs index fcef6fa..c54c376 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/MessageRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/MessageRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class MessageRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:MESSAGE"; + public static string STREAM = "zeebe:MESSAGE"; private readonly Action _consumer; - public MessageRecordConsumer(Action action) { - this._consumer = action; + public MessageRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/MessageStartEventSubscriptionRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/MessageStartEventSubscriptionRecordConsumer.cs index 9790c30..2ad3fab 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/MessageStartEventSubscriptionRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/MessageStartEventSubscriptionRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class MessageStartEventSubscriptionRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:MESSAGE_START_EVENT_SUBSCRIPTION"; + public static string STREAM = "zeebe:MESSAGE_START_EVENT_SUBSCRIPTION"; private readonly Action _consumer; - public MessageStartEventSubscriptionRecordConsumer(Action action) { - this._consumer = action; + public MessageStartEventSubscriptionRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/MessageSubscriptionRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/MessageSubscriptionRecordConsumer.cs index bddf22e..87ad1b9 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/MessageSubscriptionRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/MessageSubscriptionRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class MessageSubscriptionRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:MESSAGE_SUBSCRIPTION"; + public static string STREAM = "zeebe:MESSAGE_SUBSCRIPTION"; private readonly Action _consumer; - public MessageSubscriptionRecordConsumer(Action action) { - this._consumer = action; + public MessageSubscriptionRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/ProcessEventRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/ProcessEventRecordConsumer.cs index 998c786..9a6fb24 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/ProcessEventRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/ProcessEventRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class ProcessEventRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:PROCESS_EVENT"; + public static string STREAM = "zeebe:PROCESS_EVENT"; private readonly Action _consumer; - public ProcessEventRecordConsumer(Action action) { - this._consumer = action; + public ProcessEventRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/ProcessInstanceCreationRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/ProcessInstanceCreationRecordConsumer.cs index 31cb8bf..a1806c7 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/ProcessInstanceCreationRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/ProcessInstanceCreationRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class ProcessInstanceCreationRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:PROCESS_INSTANCE_CREATION"; + public static string STREAM = "zeebe:PROCESS_INSTANCE_CREATION"; private readonly Action _consumer; - public ProcessInstanceCreationRecordConsumer(Action action) { - this._consumer = action; + public ProcessInstanceCreationRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/ProcessInstanceRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/ProcessInstanceRecordConsumer.cs index da8f967..fec4dea 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/ProcessInstanceRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/ProcessInstanceRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class ProcessInstanceRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:PROCESS_INSTANCE"; + public static string STREAM = "zeebe:PROCESS_INSTANCE"; private readonly Action _consumer; - public ProcessInstanceRecordConsumer(Action action) { - this._consumer = action; + public ProcessInstanceRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/ProcessMesssageSubscriptionRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/ProcessMesssageSubscriptionRecordConsumer.cs index 12ae889..b645a72 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/ProcessMesssageSubscriptionRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/ProcessMesssageSubscriptionRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class ProcessMessageSubscriptionRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:PROCESS_MESSAGE_SUBSCRIPTION"; + public static string STREAM = "zeebe:PROCESS_MESSAGE_SUBSCRIPTION"; private readonly Action _consumer; - public ProcessMessageSubscriptionRecordConsumer(Action action) { - this._consumer = action; + public ProcessMessageSubscriptionRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/ProcessRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/ProcessRecordConsumer.cs index 2fd788f..1e1efc7 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/ProcessRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/ProcessRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class ProcessRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:PROCESS"; + public static string STREAM = "zeebe:PROCESS"; private readonly Action _consumer; - public ProcessRecordConsumer(Action action) { - this._consumer = action; + public ProcessRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/TimerRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/TimerRecordConsumer.cs index 9cc09f3..23653ae 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/TimerRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/TimerRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class TimerRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:TIMER"; + public static string STREAM = "zeebe:TIMER"; private readonly Action _consumer; - public TimerRecordConsumer(Action action) { - this._consumer = action; + public TimerRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/VariableDocumentRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/VariableDocumentRecordConsumer.cs index 52972f2..4a1b050 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/VariableDocumentRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/VariableDocumentRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class VariableDocumentRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:VARIABLE_DOCUMENT"; + public static string STREAM = "zeebe:VARIABLE_DOCUMENT"; private readonly Action _consumer; - public VariableDocumentRecordConsumer(Action action) { - this._consumer = action; + public VariableDocumentRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/consumer/VariableRecordConsumer.cs b/connector-csharp/zeebe-redis-connector/consumer/VariableRecordConsumer.cs index 8f41e97..c9946d1 100644 --- a/connector-csharp/zeebe-redis-connector/consumer/VariableRecordConsumer.cs +++ b/connector-csharp/zeebe-redis-connector/consumer/VariableRecordConsumer.cs @@ -1,16 +1,17 @@ using Io.Zeebe.Exporter.Proto; using System; -namespace zeebe_redis_connector.consumer +namespace Io.Zeebe.Redis.Connect.Csharp.Consumer { public class VariableRecordConsumer : IRecordConsumer { - public static String STREAM = "zeebe:VARIABLE"; + public static string STREAM = "zeebe:VARIABLE"; private readonly Action _consumer; - public VariableRecordConsumer(Action action) { - this._consumer = action; + public VariableRecordConsumer(Action action) + { + _consumer = action; } public void Consume(Record record) diff --git a/connector-csharp/zeebe-redis-connector/hostedservice/ServiceCollectionExtensions.cs b/connector-csharp/zeebe-redis-connector/hosting/ServiceCollectionExtensions.cs similarity index 95% rename from connector-csharp/zeebe-redis-connector/hostedservice/ServiceCollectionExtensions.cs rename to connector-csharp/zeebe-redis-connector/hosting/ServiceCollectionExtensions.cs index c8e7702..d85f354 100644 --- a/connector-csharp/zeebe-redis-connector/hostedservice/ServiceCollectionExtensions.cs +++ b/connector-csharp/zeebe-redis-connector/hosting/ServiceCollectionExtensions.cs @@ -1,5 +1,4 @@ -using Io.Zeebe.Redis.Connect.Csharp; -using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; diff --git a/connector-csharp/zeebe-redis-connector/hostedservice/ZeebeRedisHostedService.cs b/connector-csharp/zeebe-redis-connector/hosting/ZeebeRedisHostedService.cs similarity index 76% rename from connector-csharp/zeebe-redis-connector/hostedservice/ZeebeRedisHostedService.cs rename to connector-csharp/zeebe-redis-connector/hosting/ZeebeRedisHostedService.cs index b91a8fc..967deb6 100644 --- a/connector-csharp/zeebe-redis-connector/hostedservice/ZeebeRedisHostedService.cs +++ b/connector-csharp/zeebe-redis-connector/hosting/ZeebeRedisHostedService.cs @@ -1,5 +1,4 @@ -using Io.Zeebe.Redis.Connect.Csharp; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -20,17 +19,17 @@ public class ZeebeRedisHostedService : IHostedService, IDisposable private Task? _executeTask; - public ZeebeRedisHostedService(ZeebeRedis zeebeRedis, ILoggerFactory loggerFactory) + public ZeebeRedisHostedService(ZeebeRedis zeebeRedis, ILoggerFactory loggerFactory) { - this._logger = loggerFactory?.CreateLogger() ?? throw new ArgumentNullException(nameof(loggerFactory)); - this._zeebeRedis = zeebeRedis ?? throw new ArgumentNullException(nameof(zeebeRedis)); + _logger = loggerFactory?.CreateLogger() ?? throw new ArgumentNullException(nameof(loggerFactory)); + _zeebeRedis = zeebeRedis ?? throw new ArgumentNullException(nameof(zeebeRedis)); } public Task StartAsync(CancellationToken cancellationToken) { - this.cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); + cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); - _executeTask = _zeebeRedis.StartConsumeEvents(this.cancellationTokenSource); + _executeTask = _zeebeRedis.StartConsumeEvents(cancellationTokenSource); // If the task is completed then return it, this will bubble cancellation and failure to the caller if (_executeTask.IsCompleted) {