-
I would like to know whether it is possible to create some sort of middleware in Akka .Net in order to see when messages are queued and dequeued in an actor mailbox and how many messages are there. The reason being we want to raise a warning when a particular actor starts getting a large backlog of messages in its inbox. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I'm not sure about middleware, but you can get the count of messages from within the actor via the actor Context Context.AsInstanceOf<ActorCell>().Mailbox.MessageQueue.Count |
Beta Was this translation helpful? Give feedback.
-
One option is a custom mailbox, but it comes with caveats and works best if it the sample size is small, as peeking at this data for -every- message on every mailbox can cause problems. I have an example of this in Akka.Metrics.Mailbox which is a port from a JVM project. Phobos is likely the best option for proper/comprehensive monitoring, as it provides much more than message counts (and has a lot more effort into it than my port) |
Beta Was this translation helpful? Give feedback.
One option is a custom mailbox, but it comes with caveats and works best if it the sample size is small, as peeking at this data for -every- message on every mailbox can cause problems. I have an example of this in Akka.Metrics.Mailbox which is a port from a JVM project.
Phobos is likely the best option for proper/comprehensive monitoring, as it provides much more than …