Can we avoid creating of internal actor when doing ask re

56 views Asked by At

Akka documentation says here: The ask operation involves creating an internal actor for handling this reply, which needs to have a timeout after which it is destroyed in order not to leak resources

Is there any way we can stop this internal actor creation?

2

There are 2 answers

2
yiksanchan On

If you still want to ask, then it will create that internal actor regardless, and there is no way to avoid.

If you want to avoid the internal actor for whatever reason, you will have to use tell instead of ask.

1
Igmar Palsenberg On

There is no way to avoid this : ask() results in an actor created in the /temp/ namespace.

Some notes on the above :

Actor creation is very lightweight. Creating an actor is virtually no overhead. Doing ask() in a stream is perfectly valid. Just don't block.