I’m prototyping a system using the brand new akka-typed Java API with Persistence, Cluster and Sharding.
Currently I’m hit by the following exception:
java.lang.IllegalArgumentException: cannot wrap behavior [XXX@7fc28be1] in Behaviors.setup, Behaviors.supervise or similar
at akka.actor.typed.Behavior$.interpret(Behavior.scala:309)
when trying to tap (akka.actor.typed.javadsl.Behaviors#tap) a persistent behavior.
I’m using akka 2.5.11 but I tried also latest timestamped snapshot.
This will be solved in next version. Pull request is already merged. I think there is an issue with the timestamped snapshots at the moment. I’ll look into that. It should be included in 2.5-SNAPSHOT if you are eager to try it.
I just tested against 2.5-SNAPSHOT. The same error:
java.lang.IllegalArgumentException: cannot wrap behavior [XXX@47d9baa0] in Behaviors.setup, Behaviors.supervise or similar
at akka.actor.typed.Behavior$.interpret(Behavior.scala:336)
After upgrading to Akka 2.5.12 I tested again. Now I get the following error:
java.lang.ClassCastException: akka.persistence.RecoveryPermitter$RecoveryPermitGranted$ cannot be cast to mypackage.JobScheduleCommand
at akka.actor.typed.javadsl.Behaviors$.$anonfun$tap$1(Behaviors.scala:179)
at akka.actor.typed.javadsl.Behaviors$.$anonfun$tap$1$adapted(Behaviors.scala:179)
at akka.actor.typed.internal.BehaviorImpl$.$anonfun$tap$1(BehaviorImpl.scala:94)
at akka.actor.typed.internal.BehaviorImpl$Intercept.receive(BehaviorImpl.scala:163)
at akka.actor.typed.Behavior$.interpret(Behavior.scala:341)
at akka.actor.typed.Behavior$.interpretMessage(Behavior.scala:318)
at akka.actor.typed.internal.adapter.ActorAdapter.akka$actor$typed$internal$adapter$ActorAdapter$$handleMessage(ActorAdapter.scala:64)
at akka.actor.typed.internal.adapter.ActorAdapter$$anonfun$running$1.applyOrElse(ActorAdapter.scala:60)
That is interesting. Can you show how you define this PersistenceBehavior or how we can reproduce this issue? I’m specifically curious about where that tap/intercept comes from. I think I understand what could be causing that but it would be good to confirm that guess.