web stats
LookUp Table Implementation - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-07-2017, 03:55 AM
dpoply dpoply is offline
Mirth Newb
 
Join Date: Dec 2016
Posts: 13
dpoply is on a distinguished road
Question 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 at 05:26 AM.
Reply With Quote
  #2  
Old 04-07-2017, 04:19 AM
kirbykn2's Avatar
kirbykn2 kirbykn2 is offline
Mirth Guru
 
Join Date: Sep 2014
Location: Michigan
Posts: 565
kirbykn2 is on a distinguished road
Default

Can you put the deploy in a channel by itself?
__________________
Kirby

Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

Appliance Version 3.11.2
Mirth Connect Version 3.6.1
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_121-b13
PostgreSQL Version 9.6.3
Reply With Quote
  #3  
Old 04-07-2017, 04:51 AM
appsbyaaron's Avatar
appsbyaaron appsbyaaron is offline
Mirth Guru
 
Join Date: Nov 2011
Location: Florida, USA
Posts: 377
appsbyaaron is on a distinguished road
Default

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 at 04:56 AM.
Reply With Quote
  #4  
Old 04-07-2017, 05:00 AM
dpoply dpoply is offline
Mirth Newb
 
Join Date: Dec 2016
Posts: 13
dpoply is on a distinguished road
Default

Quote:
Originally Posted by kirbykn2 View Post
Can you put the deploy in a channel by itself?
Hi Kirby,

Could you please elaborate?

Thanks
Poply
Reply With Quote
  #5  
Old 04-07-2017, 05:09 AM
dpoply dpoply is offline
Mirth Newb
 
Join Date: Dec 2016
Posts: 13
dpoply is on a distinguished road
Default

Quote:
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:
Quote:
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 at 05:27 AM.
Reply With Quote
  #6  
Old 04-07-2017, 06:00 AM
appsbyaaron's Avatar
appsbyaaron appsbyaaron is offline
Mirth Guru
 
Join Date: Nov 2011
Location: Florida, USA
Posts: 377
appsbyaaron is on a distinguished road
Default

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.
Reply With Quote
  #7  
Old 04-10-2017, 11:46 PM
amble amble is offline
OBX.2 Kenobi
 
Join Date: Nov 2015
Posts: 91
amble is on a distinguished road
Default

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.
Reply With Quote
  #8  
Old 04-12-2017, 09:19 AM
kirbykn2's Avatar
kirbykn2 kirbykn2 is offline
Mirth Guru
 
Join Date: Sep 2014
Location: Michigan
Posts: 565
kirbykn2 is on a distinguished road
Default

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.
__________________
Kirby

Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

Appliance Version 3.11.2
Mirth Connect Version 3.6.1
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_121-b13
PostgreSQL Version 9.6.3
Reply With Quote
Reply

Tags
database, global channel map, lookup

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 05:28 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation