Announcement

Collapse

Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Executing code only once

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

  • Executing code only once

    Hello,

    I have a channel that gets HL7-ORU-Mesages. On every message it makes a lookup (using SELECT...) in the database to check if a value is in the db or not.

    The problem is that this SELECT executes on every message that my channel gets, which causes DB-Performance-Problem. Is there a way to execute the SELECT only once (for example with the first message) and then keep the result, so that for the next messages the channel doesn't need to execute it?

    Thank you,

    Svetlomir

  • #2
    Re:Executing code only once

    I don't have specifics because I've never done it before, but I think that is what a deploy script is for.
    Jon Bartels

    Zen is hiring!!!!
    http://consultzen.com/careers/
    Talented healthcare IT professionals wanted. Engineers to sales to management.
    Good benefits, great working environment, genuinely interesting work.

    Comment


    • #3
      Re:Executing code only once

      If you are in need of querying the DB based on message content, I believe that you won't be able to do that within the deploy script. How about using the Deploy script as jbartels mentioned to initialize a global variable to indicate a DBselect has not been done and place that on the map. In your transformer javascript extract the variable from the map, check the value an if a DBselect has not been performed execute one and set the variable to a value to indicate the dbselect was done? The problem I see with this approach is when the channel is stopped and started , I don't know how to detect that the channel has stopped within the transformer, if there is a way to do that then the variable initialized at deployment can be re-intitialized when the channel stops for whatever reason (Normal, Error etc)

      Post edited by: rts, at: 10/07/2008 06:31

      Comment


      • #4
        Re:Executing code only once

        Thank you guys!

        It worked with the preprocessor. I read the needed values there and saved them on an array. I mapped this array as global variable.

        It's pretty cool - the array initializes only once and then it keeps existing no matter how many messages come.

        Comment

        Working...
        X