Friday, May 27, 2022
Home Integration/Interfaces Get to Know Mirth's Configuration Map Now

Get to Know Mirth’s Configuration Map Now

What exactly is Mirth’s configuration map? And how should Mirth developers take advantage of it to create more maintainable channels?

Before diving in, it should be established that the configuration map has some key differences from the other maps that you may have worked with. The configuration map functions as a map in the same manner as the others but has some of its own nuances that you should be aware of.

Purpose

The purpose of the configuration map is to store relatively static key-value pairs that could be used in multiple places of your Mirth instance.

What do I mean by relatively static? Key-value pairs in the configuration map should not be changing very often. For example, a database connection string should not be constantly changing. This makes the configuration map a good place to store this data.

Additionally, there is a good chance that a database connection string will be used by multiple channels in your Mirth instance. This is another reason for Mirth developers to store a database connection string in the configuration map.

Storage

One major way that the configuration map differs from the other maps is in how the data is stored. All of the other maps are stored in memory while the configuration map’s contents are contained in a properties file in the Mirth installation.

Practically, this difference won’t affect developers; however, it’s good to know in the event that you ever have to do some maintenance on the Mirth installation itself.

Building the Configuration Map

Mirth developers build the configuration map differently than other maps. In fact, the configuration map exists in Mirth Connect Administrator’s graphical user interface (GUI).

After you log into Mirth Connect’s Administrator, navigate to Settings.

Select the Configuration Map tab.

Below the tab bar you will see the configuration map with all its values.

You can see that the table has the key name, the value, and then any comments regarding that key-value pair. If you need to add a key-value click ‘Add’ on the top-right hand side.

Immediately you should see a new entry appear at the bottom of the table.

Click inside the key cell and populate the key. Afterward, you can do the same for the value and comments if you wish. Once you are done, make sure to click ‘Save’ on the left-hand side.

You can also remove an entry from the configuration map. Simply select the entry and click ‘Remove’ on the right-hand side.

As you’re working with the configuration map, you can check the ‘Show Values’ checkbox which will display the content of the ‘Value’ column.

Accessing the Configuration Map

Mirth developers can use JavaScript to access values in the configuration map in their channels:

configurationMap.get('key');

You should notice that the syntax is identical to accessing other maps in Mirth. The only difference is that the configurationMap reference is used.

Utilizing the configuration map allows developers to keep their code the same even if values in the configuration map change from time to time, which is definitely possible.

For example, say that you used the configuration map to store a database connection string. At some point in the future, if the database server changes, you can simply change its value in Settings without having to alter your channel at all. Once you save the value, Mirth will automatically update the properties file behind the scenes.


It should be noted that developers should not need to access the configuration map all too often in their code. You should only use the configuration map occasionally for data points that are relatively static and need to be accessed in multiple places.

Nevertheless, any Mirth professional should be knowledgeable about the configuration map as a tool in their development arsenal.

RELATED ARTICLES

Why You Must Learn Mirth Connect’s User API Now

Prerequisites Basic knowledge of Mirth ConnectBasic knowledge of JavaScriptBasic knowledge of software documentation and APIsBasic knowledge of Java development NextGen provides several different APIs (Application Programming...

Leverage Mirth’s Channel Scripts Now

Prerequisites Basic knowledge of Mirth ConnectBasic knowledge of JavaScript Each Mirth Connect channel gives you the ability to leverage four different scripts that have different triggers,...

Reference a Custom Jar File in Mirth Connect Now

Prerequisites Knowledge of Java developmentKnowledge of Eclipse or another Java IDEKnowledge of Mirth Connect Many Mirth professionals are unaware that they can write their own custom...

Most Popular

Mirth Connect Extensions: What You Need to Know

Prerequisistes Basic Knowledge of Mirth Connect Overview Users can navigate to Mirth Connect's Extensions screen by selecting Extensions on the left-hand side. You should now see the following...

Take a Tour of System Settings in Mirth Connect Now

Prerequisites Basic Knowledge of Mirth Connect Introduction Mirth Connect has a multitude of system settings that are available for configuration. In larger companies, there will often be...

Why You Must Master Mirth’s Message Template Tool Today

Prerequisuites Basic Knowledge of Mirth ConnectKnowledge of Programming in Mirth Connect Introduction When writing scripts in Mirth Connect, you have a message template tool that allows you...

Make Sense of HL7 v2 Messages Effortlessly Now

Prerequisites Beginner Knowledge of HL7 Introduction If you've been in Healthcare Information Technology for any period of time, you have definitely heard of HL7 (Health Level 7)....

Recent Comments