From 5ec99e73f892f872f0ceb9abfb2f5fcfe0680395 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Thu, 25 Jul 2024 09:07:56 +0200 Subject: [PATCH] Refactor to use public ClusterName property Replaced the private _clusterName variable with a public ClusterName property to allow external configuration of the cluster name. Updated cluster setup configuration to use the new property, ensuring flexibility and maintainability. --- .../Features/ProtoActorFeature.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/Elsa.ProtoActor.Core/Features/ProtoActorFeature.cs b/src/modules/Elsa.ProtoActor.Core/Features/ProtoActorFeature.cs index 655028acb..506ab36b3 100644 --- a/src/modules/Elsa.ProtoActor.Core/Features/ProtoActorFeature.cs +++ b/src/modules/Elsa.ProtoActor.Core/Features/ProtoActorFeature.cs @@ -19,11 +19,19 @@ namespace Elsa.ProtoActor.Features; /// Installs the Proto Actor feature. public class ProtoActorFeature(IModule module) : FeatureBase(module) { - private string _clusterName = "elsa-cluster"; private LogLevel _diagnosticsLogLevel = LogLevel.Information; private bool _enableMetrics; private bool _enableTracing; + /// + /// Gets or sets the name of the cluster. + /// + /// + /// The ClusterName property specifies the name of the cluster that will be used by the Proto Actor feature. + /// By default, the cluster name is set to "elsa-cluster". + /// + public string ClusterName { get; set; } = "elsa-cluster"; + /// A delegate that returns an instance of a concrete implementation of . public Func CreateClusterProvider { get; set; } = _ => new TestProvider(new TestProviderOptions(), new InMemAgent()); @@ -94,7 +102,7 @@ public class ProtoActorFeature(IModule module) : FeatureBase(module) var clusterProvider = CreateClusterProvider(sp); var system = new ActorSystem(actorSystemConfig).WithServiceProvider(sp); var clusterConfig = ClusterConfig - .Setup(_clusterName, clusterProvider, new PartitionIdentityLookup()) + .Setup(ClusterName, clusterProvider, new PartitionIdentityLookup()) .WithHeartbeatExpiration(TimeSpan.FromDays(1)) .WithActorRequestTimeout(TimeSpan.FromSeconds(1000)) .WithActorSpawnVerificationTimeout(TimeSpan.FromHours(1))