How do I actually send a message to the TodoService actor in the Message Reliability example?
EntityTypeKey<TodoService.Command> entityTypeKey1 = EntityTypeKey.create(TodoService.Command.class, "todo"); EntityRef<TodoService.Command> entityRef1 = ClusterSharding.get(system).entityRefFor(entityTypeKey1, "123"); CompletionStage<Response> r = entityRef1.ask(replyTo -> new UpdateTodo("123", "tire", false, replyTo), Duration.ofSeconds(3));
I get the below error:
java.lang.ClassCastException: com.agapic.TodoService$UpdateTodo cannot be cast to akka.actor.typed.delivery.ConsumerController$Command
@patriknw: you mentioned the below: could you explain what I was trying to do vs. how it is intended to be used?
“However, I think you misunderstand how it is intended to be used. You try to use it with two levels of Sharding, one for the TodoList and one for the TodoService. The docs say " A single ShardingProducerController per ActorSystem (node) can be shared for sending to all entities of a certain entity type.” https://doc.akka.io/docs/akka/current/typed/reliable-delivery.html#sharding"