Proactive MLLP Connection in BizTalk Receive Location

November 18, 2016

The Minimal Lower Layer Protocol (MLLP) adapter, which is part of HL7 Accelerator for BizTalk(BTAHL7), enables the BizTalk Server to receive or send HL7-based messages. The MLLP adapter ensures that BizTalk Server and BTAHL7 are interoperable with HL7-based messaging applications. Please refer to the MSDN  “What’s New in BizTalk Accelerator for HL7” for more information on HL7 Accelerator for BizTalk.

BizTalk MLLP receive locations have always been listening-ports to which external systems initiate a connection in order to start sending messages.

For example, following are the steps involved in an external Electronic Patient Record (EPR) system sending one or more HL7 messages to BizTalk receive location.
oldwayofconnecting

  • EPR system initiates connection to BizTalk server via TCP and BizTalk receive location with MLLP adapter accepts it.
  • EPR system delivers one or more HL7 messages.
  • EPR system disconnects the connection.

However, some health care systems expect BizTalk receive locations to initiate a connection in order for them to start sending the messages. This was not possible in versions previous to BizTalk server 2016. In BizTalk Server 2016, Microsoft has added an additional capability to MLLP adapter in which, MLLP receive location is capable of initiating the connection with external systems in order to receive HL7 messages. This is called proactive MLLP connection from a BizTalk receive location.

For example, the following are the steps involved in a proactive MLLP connection between BizTalk server and an EPR system.
proactiveconnection

  • MLLP receive location initiates the connection and EPR systems accepts it.
  • EPR system sends one or more messages to BizTalk receive location.
  • EPR system disconnects the connection once it has sent all the messages.

In this article, I will try to explain how to configure a BizTalk MLLP receive location for a proactive MLLP connection and also how to test this using MLLPSend tool which is part of SDK.

New MLLP adapter properties in Receive location

Following are the new properties added in MLLP receive adapter configuration.
receivelocationconfig2

Property Name

Explanation

Connect Retry Time(sec) This is the number of seconds which receive location should wait before trying to connect to remote server when previous connection got disconnected. This is almost like a polling interval if the connection is terminated by the remote system as soon as a message is transmitted.
Connection Initiated by “Remote”: When receive location listens for a connection initiated from external system, then this value needs to be set as Remote. This is a traditional behaviour and hence adapter sets this value by default.

“Local”: When you want to configure receive location for the proactive MLLP connection, then the property needs to be set to the value ‘Local’.

Remote Host IP or DNS name of the remote host to which receive location establishes the connection.

This is applicable only when ‘Connection Initiated by’ property is set to ‘Local’

Remote Port Port number on which the remote server is listening for a connection.

This is applicable only when ‘Connection Initiated by’ property is set to ‘Local’

MLLP Receive location configuration

I created a receive location named BizTalk360.MLLP.ProactiveConnection.Test in BizTalk server 2016 environment.
receiveport
Configured the MLLP adapter with below property values.
receivelocationconfig1
When you enable the receive location we will see an error message in the event log

Unable to establish a remote connection due to error “No connection could be made because the target machine actively refused it 10.2.0.4:11003”.

eventlogerror

Error message clearly indicates that receive location is trying to establish connection with port number 11003 in system with IP address 10.2.0.4. This is mainly because we do not have any application, which is listening on this port yet.

Simulating external system using MLLPSend utility

In order to simulate an external system, I used MLLPSend.exe which is part of HL7 accelerator for BizTalk SDK. In BizTalk server 2016 release, MLLPSend.exe has got a new parameter called Await which makes the utility to wait for connection to be established from an MLLP receive location. I executed the below command in a command prompt.

MllpSend.exe /IP 10.2.0.4 /P 11003 /Await /SB 11 /EB 28 /CR 13 /F “C:\Srini\TutorialSampleInstance.txt”

As soon as this command is executed, the exe starts listening on port 11003. Receive location initiates the connection and an HL7 message is received into BizTalk.
mllpsend
You can notice from the above snapshot that, as soon as one message is sent out, MLLPSend utility terminates the connection.

Click to know how Data Monitoring of BizTalk HL7 MLLP Ports is performed

Demonstrating connection retry from MLLP Receive location

As explained before, MLLP receive location uses the Connect Retry Time(sec) property value to wait for establishing a new connection when previous connection is disconnected. To demonstrate this, I wanted the MLLPSend.exe utility to wait for a new connection after terminating a previous connection.  But this capability is not present in this utility.  So I tweaked the code little bit and created a new utility called MLLPLongRunningSend.exe which actually waits for a new connection for specified number of minutes. Now my command with new utility looks as below.

MLLPLongRunningSender /IP 10.2.0.4 /P 11003 /Await /SB 11 /EB 28 /CR 13 /RM 5 /F “C:\Srini\TutorialSampleInstance.txt”

Note: command, parameter RM (run minutes) indicates the number of minutes the utility will be waiting for new connections
mllpsendlongrunning
In the above run, we can clearly see that receive location established connection every 20 seconds which is the Connect Retry Time(sec)property value.

Note: The utility MLLPLongRunningSender.exe can be also useful in creating a constant load on MLLP receive location during the load testing. If you want to download this utility, please click here.

Author: Srinivasa Mahendrakar

Technical Lead at BizTalk360 UK - I am an Integration consultant with more than 11 years of experience in design and development of On-premises and Cloud based EAI and B2B solutions using Microsoft Technologies.

Get full control of your BizTalk Environments

Over 500 customers across 30+ countries depend on BizTalk360

Start your 14 days Free Trial

Back to Top