Hello, do you know how to failure immediately when sending message to non-existent cluster sharding ? Is seems akka buffered messages and keep retrying

As the title described.
I want to create a http server as a proxy node to forward http request to worker node with entity asking , there are cluster sharding init on worker node by role tag. But i can’t detect a 404 error if request typekey not exists.
I tried query cluster state by

ClusterSharding(system).shardState ! GetClusterShardingStats(Counter.TypeKey, timeout, replyTo)

But get nothing.
Btw, proxy node(http server)'s role is different from worker nodes, Does it matter? Because i can get states by GetClusterShardingStats if set same the role for proxy node as worker’s.

Not sure why you might not be getting a response to the GetClustetrShardingStats query, however, that query is expensive as it needs to talk with all cluster nodes taking part in sharding, and it would not represent quite the truth about a specific entity either as it could be existing but stopped because of a handover/rebalance.

The safe way would be to represent existing/created with a state in the entity and reply with a not-existing response message from non-created entities and then turn that into a NotFound HTTP response at the endpoint.

An alternative would be an Akka Projection readside list of created entities, to do a lookup against, but that will be eventually consistent, and add that query overhead also to requests to existing/created entities.

Thanks for your reply.

In my http service, the sharding TypeKey is user input, so it’s possible a non-exist one(maybe a typo in user input). The message just go to buffered messages, i even have no chance to deal with it.

Are there some mandatory-like features in reliable-delivery? Refer to mandatory flag in rabbitmq basic_publish, it ensure message arriving target mailbox