web stats
What is best practice? using "Code Templates" or "JAR files" ? - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 09-12-2017, 08:47 PM
vibinChander vibinChander is offline
OBX.2 Kenobi
 
Join Date: Jul 2015
Location: Chennai
Posts: 74
vibinChander is on a distinguished road
Send a message via Skype™ to vibinChander
Default What is best practice? using "Code Templates" or "JAR files" ?

Hi,

I needed answer on this question. I have some functions which I will be using repeatedly for multiple channels. I can write these functions in Code Templates also I can write them as .jar file and call them where ever I needed. But I would like to know which is the best practice to follow in Mirth?. Im using mirth version 3.4.2

Please let me know the reason behind them.
__________________

Mirth Interface Engineer
AWS DevOps
Reply With Quote
  #2  
Old 09-13-2017, 01:48 AM
odo odo is offline
OBX.3 Kenobi
 
Join Date: Feb 2017
Location: Luxembourg
Posts: 137
odo is on a distinguished road
Default

Quote:
Originally Posted by vibinChander View Post
Hi,

I needed answer on this question. I have some functions which I will be using repeatedly for multiple channels. I can write these functions in Code Templates also I can write them as .jar file and call them where ever I needed. But I would like to know which is the best practice to follow in Mirth?. Im using mirth version 3.4.2

Please let me know the reason behind them.
I would say: it depends.

When complex Java operations have to be accomplished, I go for a jar as these would be hard to maintain via code templates.

Otherwise, I would prefer a code template as it can be changed from within the Mirth IDE and be assigned to different scopes within Mirth.
Reply With Quote
  #3  
Old 09-13-2017, 04:31 AM
vibinChander vibinChander is offline
OBX.2 Kenobi
 
Join Date: Jul 2015
Location: Chennai
Posts: 74
vibinChander is on a distinguished road
Send a message via Skype™ to vibinChander
Default HL7 parsing functions and date function

Imagine i have custom date formatter function, HL7 message segment formatter functions these function are better to be in code templates or in JAR file?
__________________

Mirth Interface Engineer
AWS DevOps
Reply With Quote
  #4  
Old 09-13-2017, 05:26 AM
odo odo is offline
OBX.3 Kenobi
 
Join Date: Feb 2017
Location: Luxembourg
Posts: 137
odo is on a distinguished road
Default

Quote:
Originally Posted by vibinChander View Post
Imagine i have custom date formatter function, HL7 message segment formatter functions these function are better to be in code templates or in JAR file?
Code templates as:
  • You keep all the source code at one place.
  • You don't need to start Eclipse (or whatever java ide) if formatting ever changes.
  • You will have the ability to easily consult the code and check what it does if you have to work with the channel again after a certain period of time
  • You can easily share your code templates here in the forum if they are of worth to others
Reply With Quote
  #5  
Old 09-13-2017, 05:40 AM
vibinChander vibinChander is offline
OBX.2 Kenobi
 
Join Date: Jul 2015
Location: Chennai
Posts: 74
vibinChander is on a distinguished road
Send a message via Skype™ to vibinChander
Default How about performance

Thanks a lot.

But one more question, where my performance will be high?. While using functions from JAR or from code templates?. or will there be any latency issues on these?
__________________

Mirth Interface Engineer
AWS DevOps
Reply With Quote
  #6  
Old 09-13-2017, 06:16 AM
odo odo is offline
OBX.3 Kenobi
 
Join Date: Feb 2017
Location: Luxembourg
Posts: 137
odo is on a distinguished road
Default

Quote:
Originally Posted by vibinChander View Post
Thanks a lot.

But one more question, where my performance will be high?. While using functions from JAR or from code templates?. or will there be any latency issues on these?
This will be a question to Mirth staff as it depends on how javascript is handled in Mirth.

However to my understanding javascript performance should be virtually equal as Java as code-templates are precompiled to java-byte-code by the Rhino engine.
(see e.g Line 385 in function updateCodeTemplate() of DefaultCodeTemplateController.java)
Reply With Quote
  #7  
Old 09-13-2017, 08:22 PM
vibinChander vibinChander is offline
OBX.2 Kenobi
 
Join Date: Jul 2015
Location: Chennai
Posts: 74
vibinChander is on a distinguished road
Send a message via Skype™ to vibinChander
Smile It Helps!!!

Thank you for the answers. I just needed that clarity alone.
__________________

Mirth Interface Engineer
AWS DevOps
Reply With Quote
Reply

Tags
code template, jar, mirth 3.4.2

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 01:03 PM.


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