HL7 MLLP Connector 2.1 - Examples - Mule 4

Use these examples to read and write HL7 messages over the Minimum Lower-Layer Protocol (MLLP).

Set Global Properties

Set these global properties before using the examples:

  • Delimiter

The standard HL7 delimiter value that separates MLLP messages. It is a hexadecimal 0x1C character also known as FS. Applications in some clinics use a different delimiter value in this field. The standard value in the HL7 MLLP connector is shown as 001C.

  • Host

Sets the socket host address

  • Port

Sets the socket port

For an advanced connection, complete these fields:

  • Reuse address

Whether to reuse the configured socket or fail when trying to bind to the socket

  • Send TCP With No Delay

Whether or not to transmit data immediately, or collect data for greater efficiency before sending

  • Linger

How long (in milliseconds) the socket takes to correctly close so any remaining data transmits.

  • Keep alive

Whether to close open socket connections that are unused for a long period with an unavailable connection.

  • Fail on unresolved host

Whether the socket fails during its creation if the host (set on the endpoint) cannot be resolved.

  • TLS tab

Configure a new TLS configuration. Its presence implies the use of SSLServerSocket instead of plain TCP.

  • Set the send or receive buffer size.

Example - Read and Write Message

This example workflow sequentially invokes read and write HL7 messages over MLLP:

  • writer-flow

Sends the given message through the socket to be received by the reader-flow

  • reader-flow

Receive a MLLP message, and log the message

  • The app, index, styles, app-config, rest-service, order-controller, and write-order are used to load static resources related to the user interface.

Read and Write HL7 Messages Over MLLP

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:mllp="http://www.mulesoft.org/schema/mule/mllp"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/mllp
http://www.mulesoft.org/schema/mule/mllp/current/mule-mllp.xsd
http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/core
http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
	<mllp:mllp-listener-config name="Mule_HL7_MLLP_Listener_config"
	doc:name="Mule HL7 MLLP Listener config">
		<mllp:mllp-listener-connection host="localhost" port="40000" />
	</mllp:mllp-listener-config>
	<mllp:request-config name="Mule_HL7_MLLP_Request_config"
	doc:name="Mule HL7 MLLP Request config">
		<mllp:mllp-requester-connection host="localhost" port="40000" >
			<mllp:local-address-settings port="49999" host="localhost" />
		</mllp:mllp-requester-connection>
	</mllp:request-config>
	<http:listener-config name="HTTP_Listener_config"
	doc:name="HTTP Listener config">
		<http:listener-connection host="localhost" port="8081" />
	</http:listener-config>
	<flow name="reader-flow">
		<mllp:mllp-listener doc:name="Mllp listener"
		config-ref="Mule_HL7_MLLP_Mllp_listener_config"/>
		<logger level="INFO" doc:name="Logger" message="#[payload]"/>
	</flow>
	<flow name="writer-flow">
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config"
		path="/send"/>
		<mllp:send doc:name="Send" config-ref="Mule_HL7_MLLP_Request_config">
		</mllp:send>
	</flow>
	<flow name="index">
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config"
		path="/"/>
		<parse-template doc:name="Parse Template"
		 location="ui-demo/index.html"/>
	</flow>
	<flow name="styles">
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config"
		path="/styles"/>
		<parse-template doc:name="Parse Template"
		location="ui-demo/styles/styles.css"/>
	</flow>
	<flow name="app-config">
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/app-config"/>
		<parse-template doc:name="Parse Template"
		location="ui-demo/app-config.js"/>
	</flow>
	<flow name="app">
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config"
		path="/app"/>
		<parse-template doc:name="Parse Template"
		location="ui-demo/app.js"/>
	</flow>
	<flow name="rest-service">
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config"
		path="services/restService"/>
		<parse-template doc:name="Parse Template"
		location="ui-demo/services/restService.js"/>
	</flow>
	<flow name="order-controller">
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config"
		path="order/order.controller"/>
		<parse-template doc:name="Parse Template"
		location="ui-demo/order/order.controller.js"/>
	</flow>
	<flow name="write-order">
		<http:listener doc:name="Listener"
		config-ref="HTTP_Listener_config"
		path="/order/writeOrder"/>
		<parse-template doc:name="Parse Template"
		location="ui-demo/order/writeOrder.html"/>
	</flow>
</mule>