---
schema_version: "1"
id: 0593149a6b6840b74e9938cf7fa19a7d83f7ce30cc1990c147f3e2167a282289
title: HL7 MLLP Connector 2.2 - Examples
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/hl7-mllp-connector/latest/hl7-mllp-connector-examples.md
canonical_url: https://docs.mulesoft.com/hl7-mllp-connector/latest/hl7-mllp-connector-examples
source_site: docs.mulesoft.com
content_type: documentation
content_hash: c813ade9add92f584cd74bbaf705632743adf5310d01bb7bad9d3bfc706b4cb0
description: MuleSoft Documentation Site
release: "2.2"
latest: true
---
---
product: HL7 MLLP Connector
version: 2.2
is-latest-version: true
---

# HL7 MLLP Connector 2.2 - Examples

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

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
<?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>
```

## See Also

- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)

- [Salesforce Help](https://help.salesforce.com)
