I’ve added some additional APIs to expose more structured Background MQ stats in this commit.
So you can get info on the Queue Collection for a specific DTO Type with:
var bgService = (BackgroundMqService)container.Resolve<IMessageService>();
var mqCollection = bgService.GetCollection(typeof(Poco));
Dictionary<string, long> statsMap = mqCollection.GetDescriptionMap();
This returns the text info that mqCollection.GetDescription()
returns in a structured Dictionary of stats with the keys:
- ThreadCount
- TotalMessagesAdded
- TotalMessagesTaken
- TotalOutQMessagesAdded
- TotalDlQMessagesAdded
The dictionary also includes each the snapshot counts in each queue in the MQ Collection, e.g:
- mq:Poco.inq
- mq:Poco.priorityq
- mq:Poco.outq
- mq:Poco.dlq
You can also now get Stats of each MQ Worker, there can be multiple workers for each MQ which you can get with:
IMqWorker[] workers = bgService.GetWorkers(QueueNames<Type>.In);
List<IMessageHandlerStats> stats = workers.Map(x => x.GetStats());
And combine them with:
IMessageHandlerStats combinedStats = stats.CombineStats();
This change is available from v5.4.1 that’s now available on MyGet.