Q:

Redis MQ queue depth monitoring

In a project I am currently engaged in we are using a Redis / ServiceStack Message Queue combination. Sometimes these queues gets "congested" because some of the messages takes quite some time to process by the backend.
I would therefore like to create an "overview"/"monitoring" panel in the administration system - which is coded in ASP.net WebForms, in order to avoid people contacting me to tell them whether the queue is congested.
How would I go about diving into the queues and retrieving the amount of pending/dead messages?
Thanks!

A:

The MqStats service in the Reusability example project that shows how to introspect and provide an overview of all Redis MQ's, whilst the MqDump service shows how to introspect messages of a single DTO Type.
Redis MQ's are just Redis server-side lists that are unique to each Request DTO which take the format of mq:{DtoName}:{MQType}, e.g:
mq:RequestDto:inq
mq:RequestDto:priorityq
mq:RequestDto:outq
mq:RequestDto:dlq

You can simply use Redis List operations against the above lists to count the number of messages in each mq (aka list) and introspect each one by deserializing it into a Message which you can re-use the CreateMessage method to do.

