Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to subscribe AssociationErrorEvent in akka 2.4.7 #20864

Closed
dysonbird opened this issue Jul 1, 2016 · 1 comment
Closed

How to subscribe AssociationErrorEvent in akka 2.4.7 #20864

dysonbird opened this issue Jul 1, 2016 · 1 comment

Comments

@dysonbird
Copy link

dysonbird commented Jul 1, 2016

When i upgrade akka to 2.4.7

Cluster.get(system).subscribe(listener, ClusterDomainEvent.class, AssociationErrorEvent.class);

some problem like

Exception in thread "main" java.lang.IllegalArgumentException: requirement failed: subscribe toakka.cluster.ClusterEvent.ClusterDomainEventor subclasses, was [akka.cluster.ClusterEvent$ClusterDomainEvent, akka.remote.AssociationErrorEvent] at scala.Predef$.require(Predef.scala:224) at akka.cluster.Cluster.subscribe(Cluster.scala:233) at akka.cluster.Cluster.subscribe(Cluster.scala:214) at akka.cluster.Cluster.subscribe(Cluster.scala:213)

the source code in 2.11

def subscribe(subscriber: ActorRef, to: Class[_]): Unit = clusterCore ! InternalClusterAction.Subscribe(subscriber, to)

why change to 2.4.7

@varargs def subscribe(subscriber: ActorRef, initialStateMode: SubscriptionInitialStateMode, to: Class[_]*): Unit = { require(to.length > 0, "at least oneClusterDomainEventclass is required") require( to.forall(classOf[ClusterDomainEvent].isAssignableFrom), s"subscribe toakka.cluster.ClusterEvent.ClusterDomainEventor subclasses, was [${to.map(_.getName).mkString(", ")}]") clusterCore ! InternalClusterAction.Subscribe(subscriber, initialStateMode, to.toSet) }

How to subscribe AssociationErrorEvent ?

@patriknw
Copy link
Member

patriknw commented Jul 1, 2016

I don't know what you are comparing with, but it's documented since way back (at least 2.4.0) that "The to classes can be [[akka.cluster.ClusterEvent.ClusterDomainEvent]]"

AssociationErrorEvent is not a ClusterDomainEvent.

You can subscribe to system.eventStream for the AssociationErrorEvent

@patriknw patriknw closed this as completed Jul 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants