web stats
Total Record Count And Others - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-08-2019, 09:47 AM
kirbyjwilson kirbyjwilson is offline
OBX.2 Kenobi
 
Join Date: May 2012
Posts: 61
kirbyjwilson is on a distinguished road
Default Total Record Count And Others

Once a channel runs, I want to call a shared channel channel (via a 2nd Destination) and pass variables to it so that the channel can write the values to a table.

Does anyone know if these variables are available?

Total Record Count (messages received)
Total Record Count (messages sent)
Response (e.g. file transferred, success/failure of transfer)

Thanks,

Kirby
Reply With Quote
  #2  
Old 03-12-2019, 08:38 AM
kirbyjwilson kirbyjwilson is offline
OBX.2 Kenobi
 
Join Date: May 2012
Posts: 61
kirbyjwilson is on a distinguished road
Default

Bueller?
Reply With Quote
  #3  
Old 03-12-2019, 11:49 AM
kirbyjwilson kirbyjwilson is offline
OBX.2 Kenobi
 
Join Date: May 2012
Posts: 61
kirbyjwilson is on a distinguished road
Default

Just for reference, these are variables that I am able to pass from one channel to the other:

message.channelId
message.channelName
message.messageId
message.rawData
message.encodedData
Reply With Quote
  #4  
Old 03-13-2019, 08:59 AM
kirbyjwilson kirbyjwilson is offline
OBX.2 Kenobi
 
Join Date: May 2012
Posts: 61
kirbyjwilson is on a distinguished road
Default

No replies other than mine???
Attached Images
File Type: jpg IMG-2833.JPG (85.5 KB, 7 views)
Reply With Quote
  #5  
Old 03-14-2019, 02:46 AM
obsessio obsessio is offline
OBX.3 Kenobi
 
Join Date: Mar 2015
Location: Turkey
Posts: 166
obsessio is on a distinguished road
Default

you can get statistics from /channels/statuses with Client Api.
Reply With Quote
  #6  
Old 03-14-2019, 08:45 AM
kirbyjwilson kirbyjwilson is offline
OBX.2 Kenobi
 
Join Date: May 2012
Posts: 61
kirbyjwilson is on a distinguished road
Default

Do you have any links to documentation and/or examples of how to use the Client API to pull statistics/statuses from channels and write them to a custom table in Oracle? Thanks!
Reply With Quote
  #7  
Old 03-14-2019, 05:05 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,033
agermano is on a distinguished road
Default

If you are using a mirth channel on the same instance to collect the stats, it's probably even easier to use ChannelUtil from the User API. You can get self-hosted documentation for both the User API (Java) and the Client API (REST) by clicking the links on the left menu bar of the mirth administrator.

All of the User API classes are already imported in the javascript environment, so you can just call like the following:
Code:
var count = ChannelUtil.getReceivedCount(channelIdOrName);
Reply With Quote
  #8  
Old 03-15-2019, 09:50 AM
kirbyjwilson kirbyjwilson is offline
OBX.2 Kenobi
 
Join Date: May 2012
Posts: 61
kirbyjwilson is on a distinguished road
Default

What I have is a channel called Channel Monitor (attached) that will be called by every other individual channel (via a Destination) once it runs.

This is the SQL from the Channel Monitor channel:

INSERT INTO MIRTH_PROD_USER.CHANNEL_MONITOR
(CHANNEL_ID, CHANNEL_NAME, MESSAGE_ID, RAW_DATA, TRANSFORMED_DATA, ENCODED_DATA, MIRTH_SOURCE, MIRTH_TYPE, MIRTH_VERSION, UUID, ORIGINAL_FILE_NAME, RECORD_COUNT, D1, INSERT_DTM)
VALUES
(${channelId}, ${channelName}, ${messageId}, ${rawData}, ${transformedData}, ${encodedData}, ${mirth_source}, ${mirth_type}, ${mirth_version}, ${UUID}, ${originalFilename}, ${COUNT}, ${d1}, SYSDATE)

In place of ${COUNT}, can I simply reference a variable that is already available to me by virtue of being passed by the channel that called the Channel Monitor channel (by having this code in the Template section):

${message.channelId}|&|${message.channelName}|&|${ message.messageId}|&|${message.rawData}|&|${messag e.transformedData}|&|${message.encodedData}|&|${mi rth_source}|&|${mirth_type}|&|${mirth_version}|&|$ {UUID}|&|${originalFilename}|&|${COUNT}|&|${Respon se.d1}
Attached Files
File Type: xml Channel Monitor.xml (16.7 KB, 3 views)
Reply With Quote
  #9  
Old 03-15-2019, 09:54 AM
kirbyjwilson kirbyjwilson is offline
OBX.2 Kenobi
 
Join Date: May 2012
Posts: 61
kirbyjwilson is on a distinguished road
Default

Here is a screen shot of a channel calling the Channel Monitor channel. Instead of sending ${COUNT} in the Template section, should I send something else? Some variation of ChannelUtil.getReceivedCount(channelIdOrName)?
Attached Images
File Type: jpg Call Channel Monitor.jpg (55.5 KB, 8 views)
Reply With Quote
Reply

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:53 AM.


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