diff --git a/src/Orleans.Core/Configuration/Options/ClusterOptions.cs b/src/Orleans.Core/Configuration/Options/ClusterOptions.cs
index f832e7a619..4c928c3b9d 100644
--- a/src/Orleans.Core/Configuration/Options/ClusterOptions.cs
+++ b/src/Orleans.Core/Configuration/Options/ClusterOptions.cs
@@ -12,6 +12,11 @@ public class ClusterOptions
///
internal const string DevelopmentClusterId = "dev";
+ ///
+ /// Default service id for development clusters.
+ ///
+ internal const string DevelopmentServiceId = "dev-service";
+
///
/// Gets or sets the cluster identity. This used to be called DeploymentId before Orleans 2.0 name.
///
diff --git a/src/Orleans.Core/Core/ClientBuilderExtensions.cs b/src/Orleans.Core/Core/ClientBuilderExtensions.cs
index 7602d9b414..b82d36f31a 100644
--- a/src/Orleans.Core/Core/ClientBuilderExtensions.cs
+++ b/src/Orleans.Core/Core/ClientBuilderExtensions.cs
@@ -166,15 +166,18 @@ public static IClientBuilder ConfigureLogging(this IClientBuilder builder, Actio
///
/// The local silo's gateway port.
/// Cluster ID to use
+ /// Service ID to use
public static IClientBuilder UseLocalhostClustering(
this IClientBuilder builder,
int gatewayPort = 30000,
- string clusterId = ClusterOptions.DevelopmentClusterId)
+ string clusterId = ClusterOptions.DevelopmentClusterId,
+ string serviceId = ClusterOptions.DevelopmentServiceId)
{
return builder.UseStaticClustering(new IPEndPoint(IPAddress.Loopback, gatewayPort))
.Configure(options =>
{
- if (!string.IsNullOrWhiteSpace(clusterId)) options.ClusterId = clusterId;
+ if (string.IsNullOrWhiteSpace(options.ClusterId)) options.ClusterId = clusterId;
+ if (string.IsNullOrWhiteSpace(options.ServiceId)) options.ServiceId = serviceId;
});
}
@@ -188,7 +191,8 @@ public static IClientBuilder UseLocalhostClustering(this IClientBuilder builder,
return builder.UseStaticClustering(gatewayPorts.Select(p => new IPEndPoint(IPAddress.Loopback, p)).ToArray())
.Configure(options =>
{
- options.ClusterId = ClusterOptions.DevelopmentClusterId;
+ if (string.IsNullOrWhiteSpace(options.ClusterId)) options.ClusterId = ClusterOptions.DevelopmentClusterId;
+ if (string.IsNullOrWhiteSpace(options.ServiceId)) options.ServiceId = ClusterOptions.DevelopmentServiceId;
});
}
diff --git a/src/Orleans.Runtime/Hosting/CoreHostingExtensions.cs b/src/Orleans.Runtime/Hosting/CoreHostingExtensions.cs
index 22a0e52a7d..da781e9db7 100644
--- a/src/Orleans.Runtime/Hosting/CoreHostingExtensions.cs
+++ b/src/Orleans.Runtime/Hosting/CoreHostingExtensions.cs
@@ -48,13 +48,15 @@ public static ISiloHostBuilder ConfigureDefaults(this ISiloHostBuilder builder)
/// The endpoint of the primary silo, or to use this silo as the primary.
///
/// Cluster ID
+ /// Service ID
/// The silo builder.
public static ISiloHostBuilder UseLocalhostClustering(
this ISiloHostBuilder builder,
int siloPort = EndpointOptions.DEFAULT_SILO_PORT,
int gatewayPort = EndpointOptions.DEFAULT_GATEWAY_PORT,
IPEndPoint primarySiloEndpoint = null,
- string clusterId = ClusterOptions.DevelopmentClusterId)
+ string clusterId = ClusterOptions.DevelopmentClusterId,
+ string serviceId = ClusterOptions.DevelopmentServiceId)
{
builder.Configure(options =>
{
@@ -64,7 +66,11 @@ public static ISiloHostBuilder ConfigureDefaults(this ISiloHostBuilder builder)
});
builder.UseDevelopmentClustering(primarySiloEndpoint ?? new IPEndPoint(IPAddress.Loopback, siloPort));
- builder.Configure(options => options.ClusterId = clusterId);
+ builder.Configure(options =>
+ {
+ if (string.IsNullOrWhiteSpace(options.ClusterId)) options.ClusterId = clusterId;
+ if (string.IsNullOrWhiteSpace(options.ServiceId)) options.ServiceId = serviceId;
+ });
builder.Configure(options => options.ExpectedClusterSize = 1);
return builder;
@@ -89,10 +95,15 @@ public static ISiloHostBuilder UseDevelopmentClustering(this ISiloHostBuilder bu
public static ISiloHostBuilder UseDevelopmentClustering(
this ISiloHostBuilder builder,
Action configureOptions,
- string clusterId = ClusterOptions.DevelopmentClusterId)
+ string clusterId = ClusterOptions.DevelopmentClusterId,
+ string serviceId = ClusterOptions.DevelopmentServiceId)
{
return builder
- .Configure(options => options.ClusterId = clusterId)
+ .Configure(options =>
+ {
+ if (string.IsNullOrWhiteSpace(options.ClusterId)) options.ClusterId = clusterId;
+ if (string.IsNullOrWhiteSpace(options.ServiceId)) options.ServiceId = serviceId;
+ })
.ConfigureServices(
services =>
{
@@ -114,9 +125,16 @@ public static ISiloHostBuilder UseDevelopmentClustering(this ISiloHostBuilder bu
public static ISiloHostBuilder UseDevelopmentClustering(
this ISiloHostBuilder builder,
Action> configureOptions,
- string clusterId = ClusterOptions.DevelopmentClusterId)
+ string clusterId = ClusterOptions.DevelopmentClusterId,
+ string serviceId = ClusterOptions.DevelopmentServiceId)
{
- return builder.ConfigureServices(
+ return builder
+ .Configure(options =>
+ {
+ if (string.IsNullOrWhiteSpace(options.ClusterId)) options.ClusterId = clusterId;
+ if (string.IsNullOrWhiteSpace(options.ServiceId)) options.ServiceId = serviceId;
+ })
+ .ConfigureServices(
services =>
{
configureOptions?.Invoke(services.AddOptions());