web stats
Stopping source connector from chanel - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 09-04-2014, 04:56 PM
hubee01 hubee01 is offline
What's HL7?
 
Join Date: Sep 2014
Posts: 2
hubee01 is on a distinguished road
Default Stopping source connector from chanel

Hello,

I am working with Mirth Connect for mapping DICOM objects between systems with a lot of mesages and I would like to stop source connector when the length of the queue is biger than one number (i.e. 5000 messages) and restart it when the queue is smaller than 2000.

Is it posible to do this?

I have seen that is posible to stop the channel, but not how to stop/pause the source or destination in a channel.
From the GUI this is posible but I would like to do it from java/javascript.

Thanks a lot!
Be regards!
Reply With Quote
  #2  
Old 09-04-2014, 05:29 PM
surmenot surmenot is offline
What's HL7?
 
Join Date: Aug 2013
Posts: 2
surmenot is on a distinguished road
Default

Here is some code but it needs testing but could be a idear or a start.

!!!! CODE NOT TESTED !!!!

function QueueControl(cid){
var channelStatisticsController = Packages.com.mirth.connect.server.controllers.Chan nelStatisticsController.getInstance();
var channelStatusController = Packages.com.mirth.connect.server.controllers.Chan nelStatusController.getInstance();
var stats = channelStatisticsController.getStatistics(cid);
var state = channelStatusController.getState(cid);

//IF Queue is bigger than X
if(stats.queued > 5000) channelStatusController.pauseChannel(cid);
If (state = paused) {
if(status.queud < 2000) channelStatusController.resumeChannel(cid);
}

}

-------------------------------------------------------------
This works on the hole channel but not on a destination.
Can some one help here.
Reply With Quote
  #3  
Old 09-05-2014, 06:43 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,099
narupley is on a distinguished road
Default

FYI in 3.x you should be using ChannelUtil.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
Reply

Tags
channel, connector, destination, source, stop

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 08:07 AM.


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