Is there a way to find ServiceKey by ID?

I am using Akka Http with Kafka. For each incoming Request, i register a new actor with a unique UUID to Receptionist. This actor will be asked later for the response.

final String responseKey = UUID.randomUUID().toString();
final ServiceKey<Request> serviceKey = ServiceKey.create(Request.class, responseKey);
context.getSystem().receptionist().tell(Receptionist.register(serviceKey, responseRef));

Kafka has two pipelines, 1 for requests and 2 for responses. Every message contains responseKey.
My question is: how can find the ServiceKey by using responseKey ?

In the same way as you created it when registering:

However, you say that you register an actor for each request. I don’t think that will work well from a scalability perspective. The Receptionist is designed for handling a few (100) long lived stable actors. It is not intended to be used for high throughput of short lived actors, or too many actors.

1 Like