Announcement

Collapse
No announcement yet.

LookUp Table Implementation

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

  • LookUp Table Implementation

    Hi,

    I'm thinking of implementing Look Up table by fetching the data in global channel map at time of deployment. But, I don't want to redeploy the channel, if I'm making an update in database. Is there a way to re-run the Channel script (normally triggers at "Deploy") without actually deploying the channel to refresh the global channel map?

    Regards,
    Poply
    Last edited by dpoply; 04-07-2017, 05:26 AM.

  • #2
    Can you put the deploy in a channel by itself?
    Best,

    Kirby

    Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

    Appliance Version 3.11.4
    Mirth Connect Version 3.8.0
    Java Version 1.6.0_45-b06
    Java (64 bit) Version 1.6.0_45-b06
    Java 7 (64 bit) Version 1.7.0_151-b15
    Java 8 (64 bit) Version 1.8.0_181-b13
    PostgreSQL Version 9.6.8

    Comment


    • #3
      You could put your code into a code template as a function and call it whenever you want. This may not actually deal with config maps but you can easily create other kinds of maps.

      configurationMap.get('key'); //Not sure if you can PUT with this
      globalMap.put('key','value');
      globalChannelMap.put('key','value');
      connectorMap.put('key','value');
      channelMap.put('key','value');
      Last edited by appsbyaaron; 04-07-2017, 04:56 AM.

      Comment


      • #4
        Originally posted by kirbykn2 View Post
        Can you put the deploy in a channel by itself?
        Hi Kirby,

        Could you please elaborate?

        Thanks
        Poply

        Comment


        • #5
          Originally posted by appsbyaaron View Post
          You could put your code into a code template as a function and call it whenever you want. This may not actually deal with config maps but you can easily create other kinds of maps.

          configurationMap.get('key'); //Not sure if you can PUT with this
          globalMap.put('key','value');
          globalChannelMap.put('key','value');
          connectorMap.put('key','value');
          channelMap.put('key','value');

          Hi Aaron,

          Yes, I'm fetching the values from table and putting them into Global Channel Map. (Refer code snippet below) So that, I don't have to fire query for every message. But, let say in future I get new set of values for lookup and I update the database from backend. I don't want to re-deploy channel (avoid downtime) just because the database has been updated and I want to trigger Channel Script.

          Regards,
          Poply
          ===========================================
          Code:
          var result = dbConn.executeCachedQuery(checkIDQuery);
          logger.info(result.size());

          while (result.next()){
          logger.info(result.getString(1) + result.getString(2));
          globalChannelMap.put(result.getString(1) , result.getString(2));
          }
          Last edited by dpoply; 04-07-2017, 05:27 AM.

          Comment


          • #6
            I'm sure there are a couple ways to do this. One way would be to put your code in a code template as a function and then create a new channel to run every morning and simply call the function. It's basically refreshing the maps every day with potential new data. Then if you want to add a new table entry you don't have to disrupt production per se. You just redeploy the new channel without really effecting the others.

            I'd love to hear other ideas. It's an interesting situation for sure. I might actually want to implement something like that.

            Comment


            • #7
              We have a function to populate the lookup in code templates. Just a select statement from the lookup table.

              Then when an update is made, we add the update into the lookup table, then at the end of the update we call the populate lookup function again to reload the maps.

              Comment


              • #8
                I have a channel that closes a connection to a database. The code to close the connection is put in the deploy script. So when I deploy this channel it closes the connection.
                Best,

                Kirby

                Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

                Appliance Version 3.11.4
                Mirth Connect Version 3.8.0
                Java Version 1.6.0_45-b06
                Java (64 bit) Version 1.6.0_45-b06
                Java 7 (64 bit) Version 1.7.0_151-b15
                Java 8 (64 bit) Version 1.8.0_181-b13
                PostgreSQL Version 9.6.8

                Comment

                Working...
                X