diff --git a/akka-cluster/src/main/scala/akka/cluster/ClusterActorRefProvider.scala b/akka-cluster/src/main/scala/akka/cluster/ClusterActorRefProvider.scala index a4a1b37e86..5adb57615a 100644 --- a/akka-cluster/src/main/scala/akka/cluster/ClusterActorRefProvider.scala +++ b/akka-cluster/src/main/scala/akka/cluster/ClusterActorRefProvider.scala @@ -37,6 +37,10 @@ import akka.cluster.routing.MetricsSelector /** * INTERNAL API + * + * The `ClusterActorRefProvider` will load the [[akka.cluster.Cluster]] + * extension, i.e. the cluster will automatically be started when + * the `ClusterActorRefProvider` is used. */ class ClusterActorRefProvider( _systemName: String, @@ -51,6 +55,9 @@ class ClusterActorRefProvider( override def init(system: ActorSystemImpl): Unit = { super.init(system) + // initialize/load the Cluster extension + Cluster(system) + remoteDeploymentWatcher = system.systemActorOf(Props[RemoteDeploymentWatcher], "RemoteDeploymentWatcher") } diff --git a/akka-cluster/src/test/scala/akka/cluster/ClusterDomainEventPublisherSpec.scala b/akka-cluster/src/test/scala/akka/cluster/ClusterDomainEventPublisherSpec.scala index 188c91505c..59252ba599 100644 --- a/akka-cluster/src/test/scala/akka/cluster/ClusterDomainEventPublisherSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/ClusterDomainEventPublisherSpec.scala @@ -18,21 +18,9 @@ import akka.testkit.ImplicitSender import akka.actor.ActorRef import akka.testkit.TestProbe -object ClusterDomainEventPublisherSpec { - val config = """ - akka.cluster.auto-join = off - akka.actor.provider = "akka.cluster.ClusterActorRefProvider" - akka.remote.log-remote-lifecycle-events = off - akka.remote.netty.port = 0 - """ - - case class GossipTo(address: Address) -} - @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class ClusterDomainEventPublisherSpec extends AkkaSpec(ClusterDomainEventPublisherSpec.config) +class ClusterDomainEventPublisherSpec extends AkkaSpec with BeforeAndAfterEach with ImplicitSender { - import ClusterDomainEventPublisherSpec._ var publisher: ActorRef = _ val a1 = Member(Address("akka", "sys", "a", 2552), Up) diff --git a/akka-docs/rst/cluster/cluster-usage-java.rst b/akka-docs/rst/cluster/cluster-usage-java.rst index 113b6f2b90..c1f00d638e 100644 --- a/akka-docs/rst/cluster/cluster-usage-java.rst +++ b/akka-docs/rst/cluster/cluster-usage-java.rst @@ -31,7 +31,7 @@ A Simple Cluster Example ^^^^^^^^^^^^^^^^^^^^^^^^ The following small program together with its configuration starts an ``ActorSystem`` -with the Cluster extension enabled. It joins the cluster and logs some membership events. +with the Cluster enabled. It joins the cluster and logs some membership events. Try it out: @@ -42,8 +42,7 @@ Try it out: To enable cluster capabilities in your Akka project you should, at a minimum, add the :ref:`remoting-java` settings, but with ``akka.cluster.ClusterActorRefProvider``. -The ``akka.cluster.seed-nodes`` and cluster extension should normally also be added to your -``application.conf`` file. +The ``akka.cluster.seed-nodes`` should normally also be added to your ``application.conf`` file. The seed nodes are configured contact points for initial, automatic, join of the cluster. diff --git a/akka-docs/rst/cluster/cluster-usage-scala.rst b/akka-docs/rst/cluster/cluster-usage-scala.rst index fd57471633..5e0bc94e2b 100644 --- a/akka-docs/rst/cluster/cluster-usage-scala.rst +++ b/akka-docs/rst/cluster/cluster-usage-scala.rst @@ -25,7 +25,7 @@ A Simple Cluster Example ^^^^^^^^^^^^^^^^^^^^^^^^ The following small program together with its configuration starts an ``ActorSystem`` -with the Cluster extension enabled. It joins the cluster and logs some membership events. +with the Cluster enabled. It joins the cluster and logs some membership events. Try it out: @@ -36,8 +36,7 @@ Try it out: To enable cluster capabilities in your Akka project you should, at a minimum, add the :ref:`remoting-scala` settings, but with ``akka.cluster.ClusterActorRefProvider``. -The ``akka.cluster.seed-nodes`` and cluster extension should normally also be added to your -``application.conf`` file. +The ``akka.cluster.seed-nodes`` should normally also be added to your ``application.conf`` file. The seed nodes are configured contact points for initial, automatic, join of the cluster. diff --git a/akka-samples/akka-sample-cluster/src/main/resources/application.conf b/akka-samples/akka-sample-cluster/src/main/resources/application.conf index 09f6cd446d..507191b79c 100644 --- a/akka-samples/akka-sample-cluster/src/main/resources/application.conf +++ b/akka-samples/akka-sample-cluster/src/main/resources/application.conf @@ -12,8 +12,6 @@ akka { } } - extensions = ["akka.cluster.Cluster"] - cluster { seed-nodes = [ "akka://ClusterSystem@127.0.0.1:2551",