No announcement yet.

parameterized polling

  • Filter
  • Time
  • Show
Clear All
new posts

  • parameterized polling

    This works in a file reader....
    put into the directory and same thing in filename fields etc.

    The question is if I make this channel have more than one thread and I want each thread to be processing a different set of values.
    I was thinking to add a messageId into the key above but am unable to do this after trying several ideas.

    Any ideas please respond. Thanks. Hope this made sense?

  • #2
    I think you would have to write that in native java calls.

    I have a similar use case here:

    Diridium Technologies, Inc.


    • #3
      Yes, that would be excellent. A before poll script. Please add this feature ASAP.


      • #4
        Support the feature request on GitHub, login and upvote it. They don't look here on the forum for features for the most part.
        Diridium Technologies, Inc.


        • #5
          Do the thumbs up on the story - it's right beneath it. Create an account on GitHub if you don't have one already, it is free.
          Diridium Technologies, Inc.


          • #6
            I wrote a channel that implements a Prepoll script by using a poll file that is created on deploy, this file is read first and then in the channel's preprocessor script I check if the message is the
            text I have in this file which just says "Prepoll Script". That block runs and sets the polling field values by grabbing them from (however you want), then the next poll will look for that file and sets the polling back to the polling file afterward processing work is done. I have added channel pauses for the channel while I debug and perfect the code, but I think they may be removed later. This channel is not perfect enough to post here yet. But if you are good at mirth connect
            and re-read this post you can figure out how to do the same thing. After a few hours of work I think it is working correctly now.
            Last edited by StickyBandit; 03-31-2021, 07:27 PM.


            • #7
              I did not care to change polling time. It just polls every 1ms. It won't get stuck because I add a .dot to the poll filename, until the next poll completes, Then remove the dot so it will poll again, same thing if it errors or the other file does not actually exist. It works, but I am still trying to test with multiple threads. Ideally I think I want each thread to have its own poll file. Still working on that.


              • #8
                Also I do not manually build anything. There are two polls for each file I actually want. The first poll is my poll file, which then let's me run code in the pre-processor and change poll values. The second poll will poll the actual file that needs processed. Then its back to poll one again. etc. etc.


                • #9
                  Here is the channel, feel free to criticize it or comment or suggest, but it does seem to be a useable solution until Mirth adds the Prepoll script.

                  PROBLEM: If someone deletes the target file within the 10 second polling time then you will be stuck in polling mode for that directory and filename.
                  SOLUTION: Shorten the poll time or have some other code that you get the directory and filename from take care of this in some manner, maybe creating a blank file. Hopefully this won't happen within the poll time. Maybe 1 second would be better, but if there are no files, this channel will still poll the Prepoll file 86,400 times a day.
                  Attached Files
                  Last edited by StickyBandit; 04-02-2021, 09:53 AM.


                  • #10
                    I changed .exists() in the pre-processor to... .getAbsoluteFile().isFile() This is more reliable.