开发者

how to get the size of message queue from akka actor?

开发者 https://www.devze.com 2023-02-17 17:32 出处:网络
There are Akka (Java API) actors (UntypeActor) and messages in the application. According to API contract in case a few messages are addressed to the same actor, they are queued and processed with one

There are Akka (Java API) actors (UntypeActor) and messages in the application. According to API contract in case a few messages are addressed to the same actor, they are queued and processed with one-by-one.

I'd like to handle messages in the a开发者_如何学Pythonctor depending on queue size. Basically: is there at least one more message queued at the moment current one is handled in Actor.onReceive()? What is the Akka way to archive this?


From within the UntypedActor you do:

getContext().getMailboxSize();

0

精彩评论

暂无评论...
验证码 换一张
取 消