web stats
Dynamic Polling frecuency - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 08-22-2013, 03:24 AM
r4z0 r4z0 is offline
Mirth Newb
 
Join Date: Feb 2012
Posts: 16
r4z0 is on a distinguished road
Default Dynamic Polling frecuency

Hello:
I would like to configure the polling interval of a JavaScript Source Connector by a globalMap variable.

How can i do it?

I tried to change the properties of the connector by javascript, but it does not affect it.
The next time i ask for the properties it said 5000 for PollingInterval, but still doing the polling at 1000ms.
Quote:
//Retrieve properties
var properties = Packages.com.mirth.connect.server.controllers.Chan nelController.getInstance().getDeployedChannelById (channelId).getSourceConnector().getProperties();

//Update properties polling Interval
properties.setProperty("pollingFrequency",5000);

//Update Connector
Packages.com.mirth.connect.server.controllers.Chan nelController.getInstance().getDeployedChannelById (channelId).getSourceConnector().setProperties(pro perties);
Quote:
Return of getProperties:
{pollingFrequency=5000, script=var texto = Packages.com.mirth.connect.server.controllers.Chan nelController.getInstance().getDeployedChannelById (channelId).getSourceConnector().getProperties();
logger.info( texto);, pollingType=interval, DataType=JavaScript Reader, host=sink}
Thanks
Reply With Quote
  #2  
Old 08-22-2013, 07:18 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,119
narupley is on a distinguished road
Default

You won't be able to change that, because the frequency is set when the channel is deployed.
__________________
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
  #3  
Old 08-22-2013, 09:45 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,246
cory_cole is on a distinguished road
Default

You can however, create a loop that sleeps for the period of time that you want.
Reply With Quote
  #4  
Old 08-23-2013, 03:52 AM
r4z0 r4z0 is offline
Mirth Newb
 
Join Date: Feb 2012
Posts: 16
r4z0 is on a distinguished road
Default

Can i script an auto redeploy at the first time to change polling interval?

Thanks for all
Reply With Quote
  #5  
Old 08-23-2013, 06:22 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,119
narupley is on a distinguished road
Default

Quote:
Originally Posted by r4z0 View Post
Can i script an auto redeploy at the first time to change polling interval?

Thanks for all
Yes, you can do that. You'll have to have a variable or something in one of the global maps to keep track of the "first time" though. In 2.x, look at EngineController. In 3.0 you can just use ChannelUtil directly.
__________________
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
  #6  
Old 08-26-2013, 01:34 AM
r4z0 r4z0 is offline
Mirth Newb
 
Join Date: Feb 2012
Posts: 16
r4z0 is on a distinguished road
Default

Thanks!
Reply With Quote
Reply

Tags
connector, javascript, polling

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 12:18 PM.


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