0
votes

I'm using Akka Cluster and I want to listen on the event of MemberJoined and MemberLeft:

override def preStart(): Unit = {
  cluster.subscribe(self, classOf[MemberEvent], classOf[MemberJoined], classOf[MemberLeft])
}

The problem is that it requires the following dependency:

"com.typesafe.akka" % "akka-cluster_2.11.xx" % "2.4.12"

But I have to use Scala 2.10 (I can't change it to 2.11) and from the Akka API for Scala 2.10 those 2 events are missing: Akka API for Scala 2.10 (exists on Akka API for Scala 2.11)

Is there any other way I can listen on those events?

override def receive = {
  case MemberJoined(member) => println(s"member joined $member")
  case MemberLeft(member) => println(s"member left $member")
}
1

1 Answers

0
votes

The difference is not between scala versions, but between Akka versions. Akka 2.4.x is not compatible with Scala 2.10, only Akka 2.3.x is compiled against Scala 2.10.

As far as I'm aware, the changes of the clustering implementation are done only in 2.4.x and not back-ported to 2.3.x version.