No announcement yet.

Monitoring progress of message

  • Filter
  • Time
  • Show
Clear All
new posts

  • Monitoring progress of message

    This question is not specific to Mirth, but I am wondering if we can use Mirth to accomplish it. We have a situation where we can receive a message and it goes through several steps. Some of those steps can run concurrently and some cannot. What we are wondering is is there a way that Mirth can monitor the progress and know when to trigger the next step or steps.


    A message goes through 7 processes. Process 1 runs before 2-6 and then 7 runs. 7 can only run after all steps 2-6 are finished and 2-6 can only run after 1 finished. Steps 2-6 can run concurrently.

    We can break the entire chain into 3 separate segments and monitor that fairly easily. The trouble comes in the 2-6 steps (call it segment 2) and tracking how to tell if they have all finished before moving on to the 3rd segment.

    Again I understand this is not a specific to Mirth issue, just wondering if anyone out in the community has solved a similar problem. Thanks in advance.

  • #2
    I think you can achieve it by adding Boolean flags in segment 2 you can monitor it. Something like

    if(flag2&&flag3&&flag4&&flag5&&flag6) {
    HL7v2.7 Certified Control Specialist!


    • #3
      Thanks siddharth. We thought about that but it would only work if the number of steps is static. We were trying to think of more of a row based approach so that that the code base could be generalized and not be bound to a static number concurrent processing steps. This way we could use mirth to monitor a table and make decisions based on if it thinks the set of processes are finished. However, this is proving to be trickier than we initially thought. Thank you though!


      • #4
        One way I've dealt with this situation before is to use a file reader.

        Step one: runs it's process and upon completion writes a file named "step1done.txt" out to a folder.

        Step two: A file reader waits for "step1done.txt" to appear. Once it's there it runs its functions and writes a file named "step2done.txt". It also deletes "step1done.txt" so it doesn't run when it shouldn't.

        A separate file named something like "steplog.txt" can be written to by each step/channel so you know where things left off when the entire process doesn't complete. There's a lot that can be done by this method. Might be clunky but it works.

        Just spitballing here but in your case you could have Steps 2-6 write out to a file and append their steps into it. So file "2through6.txt" would contain
        '2,3,4,5,6" or however you want to deal with it. It could look like "4,3,2,6,5" as long as all the steps have written to it. Then step 7 would read in the file and look for ALL the steps. It will keep reading the file each time it is written to until all steps are there. Then it can run and delete the "2through6.txt" file.

        You could also use this technique with a database but then you'll have to deal with databases. Might not need to if you can just deal with it in simple folders and files. But there are options.
        Last edited by appsbyaaron; 03-22-2017, 12:16 PM.