web stats
ChannelUtil question - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-02-2015, 10:54 AM
Rubicon Rubicon is offline
OBX.2 Kenobi
 
Join Date: Feb 2013
Posts: 98
Rubicon is on a distinguished road
Default ChannelUtil question

Hello all,
I read all the threads that have to do with ChannelUtil, but I am a little confused on where or how to implement that class.

Does the ChannelUtil go in the Preprocessor or Transformer or a Code Template.

What I am trying to do is get the Channel Name, Channel ID and the connectors into one readable file.

Does any on have an example that they can share?

Thank you,
Rubi
Reply With Quote
  #2  
Old 12-03-2015, 05:02 AM
jadams4's Avatar
jadams4 jadams4 is offline
OBX.3 Kenobi
 
Join Date: Aug 2015
Posts: 143
jadams4 is on a distinguished road
Default

Hi Rubi,

I do not have an example but here is a link to ChannelUtil.

http://javadocs.mirthcorp.com/connec...annelUtil.html

This is for version 3.2.2 not sure what version you are on?

I usually use it in a javascript transformer step. You could also do:
Code:
 logger.info(ChannelUtil.getChannelNames());
to see what results you are getting.

Also don't forget about auto complete Mirth has added, you can type ChannelUtil. and a list will appear with uses.

Can you clarify more the use you need? You want the channel name/channel id/ and connectors of each channel in connect?

Hope this helps some!
Reply With Quote
  #3  
Old 12-03-2015, 05:16 AM
Rubicon Rubicon is offline
OBX.2 Kenobi
 
Join Date: Feb 2013
Posts: 98
Rubicon is on a distinguished road
Default

Hi jadams4,

I am on version 3.2.0 and Yes I am looking to get the Channel Name/Channel ID/ Is the Channel Enabled or disabled/Connectors and if connectors are Enabled or disabled.

Wouldn't the logger.info(ChannelUtil.getChannelNames()); just place the message in the Dash board? I am looking to write it to a file.
Reply With Quote
  #4  
Old 12-03-2015, 05:17 AM
mcalKno mcalKno is offline
 
Join Date: Apr 2015
Location: Pennsylvania
Posts: 247
mcalKno is on a distinguished road
Default

Quote:
Originally Posted by Rubicon View Post
Hi jadams4,

I am on version 3.2.0 and Yes I am looking to get the Channel Name/Channel ID/ Is the Channel Enabled or disabled/Connectors and if connectors are Enabled or disabled.

Wouldn't the logger.info(ChannelUtil.getChannelNames()); just place the message in the Dash board? I am looking to write it to a file.
To write to file, you could code that within a transformer step.
Reply With Quote
  #5  
Old 12-03-2015, 05:24 AM
Rubicon Rubicon is offline
OBX.2 Kenobi
 
Join Date: Feb 2013
Posts: 98
Rubicon is on a distinguished road
Default

I'm not sure on how to do that. What would be the source? Where do I put the transformer? In source Tab or destination Tab?
Reply With Quote
  #6  
Old 12-03-2015, 05:44 AM
jadams4's Avatar
jadams4 jadams4 is offline
OBX.3 Kenobi
 
Join Date: Aug 2015
Posts: 143
jadams4 is on a distinguished road
Default

Yes, this would place it in the dashboard. I meant you could use this to see if the information you want is correct. Then once you have what you want, for example:

logger.info("Is channel deployed: " +ChannelUtil.getChannelState());
logger.info(whatever other info you want here);
// keep logging until you have everything you want

Once you verify everything you want is working how you intend in the dashboard, you could create a destination with these transformers that is a file write. Then save this info in the channelmap and use it in the template to write to a file.
Reply With Quote
  #7  
Old 12-03-2015, 05:57 AM
mcalKno mcalKno is offline
 
Join Date: Apr 2015
Location: Pennsylvania
Posts: 247
mcalKno is on a distinguished road
Default

Destination Transformer:
Code:
var fileContents = 'ChannelId: '+channelId+'\n'+'Channel Name: '+ChannelUtil.getChannelName(channelId);
channelMap.put('fileContents', fileContents);
Destination File writer template:
Code:
${fileContents}
Reply With Quote
  #8  
Old 04-03-2019, 11:24 PM
Mirthvu14 Mirthvu14 is offline
Mirth Newb
 
Join Date: Jan 2019
Posts: 25
Mirthvu14 is on a distinguished road
Default

Quote:
Originally Posted by jadams4 View Post
Yes, this would place it in the dashboard. I meant you could use this to see if the information you want is correct. Then once you have what you want, for example:

logger.info("Is channel deployed: " +ChannelUtil.getChannelState());
logger.info(whatever other info you want here);
// keep logging until you have everything you want

Once you verify everything you want is working how you intend in the dashboard, you could create a destination with these transformers that is a file write. Then save this info in the channelmap and use it in the template to write to a file.
Hello,
I try
Code:
ChannelUtil.getConnectorState
. It returns the DeployedState status (Started\stopped).
Is there a way to get 'enable\disable' status of a connector?
Reply With Quote
Reply

Tags
channel name, channelutil, connector

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 06:25 PM.


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