diff --git a/src/Akka.Hosting/AkkaHostingExtensions.cs b/src/Akka.Hosting/AkkaHostingExtensions.cs
index bb9cea81..148c4907 100644
--- a/src/Akka.Hosting/AkkaHostingExtensions.cs
+++ b/src/Akka.Hosting/AkkaHostingExtensions.cs
@@ -1,5 +1,6 @@
using System;
using System.IO;
+using System.Linq;
using Akka.Actor;
using Akka.Actor.Setup;
using Akka.Configuration;
@@ -145,5 +146,31 @@ public static AkkaConfigurationBuilder WithActors(this AkkaConfigurationBuilder
return builder.StartActors(actorStarter);
}
+ ///
+ /// Adds a list of Akka.NET extensions that will be started automatically when the
+ /// starts up.
+ ///
+ ///
+ ///
+ /// // Starts distributed pub-sub, cluster metrics, and cluster bootstrap extensions at start-up
+ /// builder.WithExtensions(
+ /// typeof(DistributedPubSubExtensionProvider),
+ /// typeof(ClusterMetricsExtensionProvider),
+ /// typeof(ClusterBootstrapProvider));
+ ///
+ ///
+ /// The builder instance being configured.
+ /// A list of extension providers that will be automatically started
+ /// when the starts
+ /// The same instance originally passed in.
+ public static AkkaConfigurationBuilder WithExtensions(
+ this AkkaConfigurationBuilder builder,
+ params Type[] extensions)
+ {
+ builder.AddHocon(
+ $"akka.extensions=[{string.Join(", ", extensions.Select(s => $"\"{s.AssemblyQualifiedName}\""))}]",
+ HoconAddMode.Prepend);
+ return builder;
+ }
}
}