Mirth Connect, SOA, ESB, HL7

Mirth Connect is a Service Oriented Integration Platform based on Mule ESB. Mirth Connect is specifically designed for HL7 (Health Level Seven - set of standards for the health messages exchanging) message exchange.

Mirth Connect as a SOA Platform provides tools for developing, testing, deploying, and monitoring interfaces (channel for the exchange of HL7 messages).

[caption id="" align="alignnone" width="491" caption="Mirth Connect Architecture"]Mirth Connect Architecture[/caption]

Mirth Connect is a project Open Source with Mozilla Public License 1.1 (MPL 1.1) and can be downloaded from here http://www.mirthcorp.com/community/downloads

Well, we will explain how to install on Ubuntu and how to switch Derby database server to MySQL server.

1. Install Java

[sourcecode language="text" gutter="true" wraplines="false"]
amawta@yachaywasi:~$ sudo apt-get install openjdk-6-jdk
[/sourcecode]

2. Install Mirth Connect

1. Download and setup execution permissions:

[sourcecode language="text" gutter="true" wraplines="false"]
amawta@yachaywasi:~$ chmod +x mirthconnect-2.1.0.5389.b671-unix.sh
amawta@yachaywasi:~$ sudo ./mirthconnect-2.1.0.5389.b671-unix.sh
[/sourcecode]

2. Verify Mirth Connect installation:

Go to http://localhost:8080 where you can access to Mirth Connect Server via Java App Admin console.
The administrator user and password are admin and admin, change it!.
If you can not connect to server, then start it.

3. Start Mirth Connect from Manager (mcmanager), Server (mcserver) or as Service (mcservice).

[sourcecode language="text" gutter="true" wraplines="false"]
amawta@yachaywasi:/opt/mirthconnect$ sudo ./mcservice start
[/sourcecode]

verify again Mirth Connect is running.

3. Switch from Derby database to MySQL server

1. Install MySQL:

[sourcecode language="text" gutter="true" wraplines="false"]
amawta@yachaywasi:~$ sudo apt-get install mysql-server mysql-client
[/sourcecode]

and verify if MySQL is running:

[sourcecode language="text" gutter="true" wraplines="false"]
amawta@yachaywasi:~$ netstat -tulpan
[/sourcecode]

or starting:

[sourcecode language="text" gutter="true" wraplines="false"]
amawta@yachaywasi:~$ sudo service mysql start
[/sourcecode]

after, connect to MySQL:

[sourcecode language="text" gutter="true" wraplines="false"]
amawta@yachaywasi:~$ mysql -u root -p
[/sourcecode]

2. Create an empty database and an user for Mirth Connect:

[sourcecode language="text" gutter="true" wraplines="false"]
CREATE DATABASE mirthdb DEFAULT CHARACTER SET utf8;
GRANT ALL ON mirthdb.* TO mirthuser@'localhost' IDENTIFIED BY 'demodemo' WITH GRANT OPTION;
GRANT ALL ON mirthdb.* TO mirthuser@'%' IDENTIFIED BY 'demodemo' WITH GRANT OPTION;
[/sourcecode]

If you want to connect from other PC different to localhost, then edit /etc/mysql/my.cnf
and comment the line "bind-address = 127.0.0.1", after re-start MySQL.

3. Stop Mirth Connect:

[sourcecode language="text" gutter="true" wraplines="false"]
amawta@yachaywasi:/opt/mirthconnect$ sudo ./mcservice stop
[/sourcecode]

4. Edit the %MIRTH_HOME%/conf/mirth.properties file and set the “database” property to the database of your choice, for example “mysql” (no quotes).
Also, set the “database.url”, “database.username”, and “database.password” properties. In this case are:

[sourcecode language="text" gutter="true" wraplines="false"]
database = mysql
database.url =jdbc:mysql://localhost:3306/mirthdb
database.username = mirthuser
database.password = demodemo
[/sourcecode]

6. Restart the Mirth Connect Server and check logs.
Mirth Connect server will create a new database schema:

[sourcecode language="text" gutter="true" wraplines="false"]
amawta@yachaywasi:/opt/mirthconnect$ sudo ./mcserver
INFO 2011-05-09 16:52:13,769 [Thread-1] com.mirth.connect.server.Mirth: Mirth Connect 2.1.0.5389 (Built on April 25, 2011) server successfully started.
INFO 2011-05-09 16:52:13,771 [Thread-1] com.mirth.connect.server.Mirth: This product was developed by Mirth Corporation (http://www.mirthcorp.com) and its contributors (c)2005-2011.
INFO 2011-05-09 16:52:13,772 [Thread-1] com.mirth.connect.server.Mirth: Running OpenJDK Server VM 1.6.0_20 on Linux (2.6.35-22-generic, i386), mysql, with charset UTF-8.
[/sourcecode]

To verify new schema do the following:

[sourcecode language="text" gutter="true" wraplines="false"]
amawta@yachaywasi:~$ mysqlshow -u mirthuser -p mirthdb
Enter password:
Database: mirthdb
+--------------------+
| Tables |
+--------------------+
| ALERT |
| ALERT_EMAIL |
| ATTACHMENT |
| CHANNEL |
| CHANNEL_ALERT |
| CHANNEL_STATISTICS |
| CODE_TEMPLATE |
| CONFIGURATION |
| ENCRYPTION_KEY |
| EVENT |
| MESSAGE |
| PERSON |
| SCHEMA_INFO |
| SCRIPT |
| TEMPLATE |
+--------------------+
[/sourcecode]

7. Now you could connect to Mirth, go to http://localhost:8080, start Mirth Connect Administrator, the default user and password will be admin/admin, change it again.

[caption id="" align="alignnone" width="473" caption="Mirth Connect Administration"]Mirth Connect Administration[/caption]

Regards.