Announcement

Collapse
No announcement yet.

Dynamic Polling frecuency

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.
    //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);
    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

  • #2
    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.

    Comment


    • #3
      You can however, create a loop that sleeps for the period of time that you want.

      Comment


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

        Thanks for all

        Comment


        • #5
          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.

          Comment


          • #6
            Thanks!

            Comment

            Working...
            X