web stats
Message throughput - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-13-2015, 05:54 AM
seaston seaston is offline
OBX.3 Kenobi
 
Join Date: Feb 2010
Location: London, UK
Posts: 168
seaston is on a distinguished road
Default Message throughput

Hello all. I'm trying to come up with some way to monitor a channel's activity (number of messages received within the last hour), and have thought about various approaches to this. I don't really want to query the Mirth database so have considered if it is possible to use the global map to keep a record of received message IDs, but I am not sure how to expire old values and one keep one hours worth so that I can count them.
What would be your suggestions on the best approach? I have not managed to find examples on the forum.
Reply With Quote
  #2  
Old 04-13-2015, 08:44 AM
seaston seaston is offline
OBX.3 Kenobi
 
Join Date: Feb 2010
Location: London, UK
Posts: 168
seaston is on a distinguished road
Default

This seems to do the job:

Code:
// keep 20 seconds worth of message IDs
if (globalChannelMap.get('messages20') == null) {
	globalChannelMap.put('messages20',new Packages.com.google.common.cache.CacheBuilder.newBuilder().expireAfterWrite(20,java.util.concurrent.TimeUnit.SECONDS).build());
}

$gc('messages20').cleanUp();
$gc('messages20').put(connectorMessage.getMessageId(),'');
logger.info('Number of messages in the last 20 seconds = ' + $gc('messages20').size());
Any better suggestions?
Reply With Quote
  #3  
Old 04-14-2015, 11:45 AM
rdejournett rdejournett is offline
OBX.2 Kenobi
 
Join Date: Jan 2013
Posts: 98
rdejournett is on a distinguished road
Default

Well, you could write to a simple database table with col1 = messageid, col2 = datetime. Then you can easily group by minute, hour, day, etc.

There would be a tiny performance hit since you are adding a database write step, but I don't see this to be much.
Reply With Quote
Reply

Tags
monitoring, throughput

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 05:28 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation