[1.6.4/Scala] Testkit starts up Akka cluster for StandaloneLagomClientFactory when not requested
See original GitHub issueLagom Version (1.2.x / 1.3.x / etc)
1.6.4
API (Scala / Java / Neither / Both)
Scala
Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)
Mac OS 10.15.7
JDK (Oracle 1.8.0_112, OpenJDK 1.8.x, Azul Zing)
java version “1.8.0_172” Java™ SE Runtime Environment (build 1.8.0_172-b11) Java HotSpot™ 64-Bit Server VM (build 25.172-b11, mixed mode)
Library Dependencies
"com.lightbend.lagom" %% "lagom-scaladsl-testkit" % "1.6.4"
Expected Behavior
When creating a client with StandaloneLagomClientFactory
, unless explicitly requested an Akka cluster is not bootstrapped.
Actual Behavior
When the client starts up, an Akka cluster is bootstrapped:
[INFO ][2021-03-31 17:32:54,771][akka.remote.artery.tcp.ArteryTcpTransport][application-akka.actor.default-dispatcher-5][akkaAddress=akka://application@192.168.1.15:25520, sourceThread=pool-7-thread-4-ScalaTest-running-ExampleValidLagomOpenApiCompatibilitySpec, akkaSource=ArteryTcpTransport(akka://application), sourceActorSystem=application, akkaTimestamp=22:32:54.771UTC] Remoting started with transport [Artery tcp]; listening on address [akka://application@192.168.1.15:25520] with UID [-6744528107701742272] [---]
[INFO ][2021-03-31 17:32:54,796][akka.cluster.Cluster][application-akka.actor.default-dispatcher-5][akkaAddress=akka://application@192.168.1.15:25520, sourceThread=pool-7-thread-4-ScalaTest-running-ExampleValidLagomOpenApiCompatibilitySpec, akkaSource=Cluster(akka://application), sourceActorSystem=application, akkaTimestamp=22:32:54.796UTC] Cluster Node [akka://application@192.168.1.15:25520] - Starting up, Akka version [2.6.8] ... [---]
[INFO ][2021-03-31 17:32:54,903][akka.cluster.Cluster][application-akka.actor.default-dispatcher-5][akkaAddress=akka://application@192.168.1.15:25520, sourceThread=pool-7-thread-4-ScalaTest-running-ExampleValidLagomOpenApiCompatibilitySpec, akkaSource=Cluster(akka://application), sourceActorSystem=application, akkaTimestamp=22:32:54.903UTC] Cluster Node [akka://application@192.168.1.15:25520] - Registered cluster JMX MBean [akka:type=Cluster] [---]
[INFO ][2021-03-31 17:32:54,903][akka.cluster.Cluster][application-akka.actor.default-dispatcher-5][akkaAddress=akka://application@192.168.1.15:25520, sourceThread=pool-7-thread-4-ScalaTest-running-ExampleValidLagomOpenApiCompatibilitySpec, akkaSource=Cluster(akka://application), sourceActorSystem=application, akkaTimestamp=22:32:54.903UTC] Cluster Node [akka://application@192.168.1.15:25520] - Started up successfully [---]
[INFO ][2021-03-31 17:32:54,931][akka.cluster.Cluster][application-akka.actor.default-dispatcher-5][akkaAddress=akka://application@192.168.1.15:25520, sourceThread=application-akka.actor.internal-dispatcher-3, akkaSource=Cluster(akka://application), sourceActorSystem=application, akkaTimestamp=22:32:54.930UTC] Cluster Node [akka://application@192.168.1.15:25520] - No downing-provider-class configured, manual cluster downing required, see https://doc.akka.io/docs/akka/current/typed/cluster.html#downing [---]
[INFO ][2021-03-31 17:32:54,931][akka.cluster.Cluster][application-akka.actor.default-dispatcher-5][akkaAddress=akka://application@192.168.1.15:25520, sourceThread=application-akka.actor.internal-dispatcher-3, akkaSource=Cluster(akka://application), sourceActorSystem=application, akkaTimestamp=22:32:54.931UTC] Cluster Node [akka://application@192.168.1.15:25520] - No seed-nodes configured, manual cluster join required, see https://doc.akka.io/docs/akka/current/typed/cluster.html#joining [---]
Reproducible Test Case
import com.lightbend.lagom.scaladsl.client.{StandaloneLagomClientFactory, StaticServiceLocatorComponents}
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
import org.scalatest.BeforeAndAfterAll
import play.api.libs.ws.ahc.AhcWSComponents
import java.net.URI
class Lagom3211Tests extends AnyWordSpec with Matchers with BeforeAndAfterAll {
private val clientFactory = new StandaloneLagomClientFactory("client")
with AhcWSComponents
with StaticServiceLocatorComponents {
override def staticServiceUri: URI = new URI("http://lagomframework.com")
}
override protected def afterAll(): Unit = clientFactory.stop()
"client" should {
"use 'local' provider" in {
val provider = clientFactory.actorSystem.settings.config.getString("akka.actor.provider")
provider shouldBe "local"
}
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Cluster Usage • Akka Documentation
Build distributed applications that scale across the network with Akka Cluster, a fault-tolerant decentralized peer-to-peer based cluster node membership ...
Read more >Default configuration - Documentation - Akka
Akka is a toolkit for building highly concurrent, distributed, and resilient message-driven applications for Java and Scala.
Read more >Cluster Usage — Akka Documentation
When a new node is started it sends a message to all seed nodes and then sends join command to the one that...
Read more >Cluster Membership Service - Documentation - Akka
The Akka Cluster node membership service, manages dynamic member states and lifecycle with no external infrastructure needed.
Read more >Cluster Usage - Documentation - Akka
The core of Akka Cluster is the cluster membership, to keep track of what ... If no one of the seed nodes replied...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t think this is the case. You can have the cluster dependencies in the classpath and the testkit will make sure that its actor system will be configured to use the local provider.
What is happening here is that there is another unmanaged actor system that is being start by the
StandaloneLagomClientFactory
.This is not something that I think we should ‘fix’ because the
StandaloneLagomClientFactory
wasn’t designed to be used in a Lagom application.@solarmosaic-kflorence, this is not what I observed.
Please check this minimal hello-world I published here: https://github.com/octonato/minimal-lagom-without-cluster
Check the tests. It isn’t using cluster and the loaded config shows it is a
local
provider.Please, verify if your loader is not loading any component that is requiring cluster. If the cluster component is included, it will bootstrap the cluster.