Skip to content
LambogeniusDocs

HL7 MLLP Connector for Azure Logic Apps

Quick start: built-in connector

Add the trigger and actions to a Logic Apps Standard project and run it locally.

Service provider/serviceProviders/lamboHl7MllpLicensed together with the HL7 v2 Codec. One token covers both.

Add the connector to a Logic Apps Standard project

  1. 1
    Reference the package

    in a NuGet-based Logic App project. Download Lambogenius.MllpConnector.LogicApps.<version>.nupkg from Downloads (sign in first), save it in a folder such as packages/, and make that folder a package source in nuget.config.

    <ItemGroup>
      <PackageReference Include="Lambogenius.MllpConnector.LogicApps" Version="<version>" />
    </ItemGroup>

    The host.json the runtime reads must not have an extensionBundle section, or the runtime ignores the project's packages. The VS Code extension re-adds it to the source file, so remove it from the build and publish copies (the sample project's RemoveExtensionBundleFrom*HostJson targets do this).

  2. 2
    Add connections

    to connections.json: one per listening port, and one per destination.

    {
      "serviceProviderConnections": {
        "mllpListenerAdt": {
          "displayName": "MLLP listener (ADT)",
          "serviceProvider": { "id": "/serviceProviders/lamboHl7Mllp" },
          "parameterValues": {
            "host": "@appsetting('MLLP_RECEIVE_HOST')",
            "port": "@appsetting('MLLP_RECEIVE_ADT_PORT')",
            "encoding": "auto"
          }
        },
        "mllpEmr": {
          "displayName": "MLLP destination (EMR)",
          "serviceProvider": { "id": "/serviceProviders/lamboHl7Mllp" },
          "parameterValues": {
            "host": "@appsetting('MLLP_EMR_HOST')",
            "port": "@appsetting('MLLP_EMR_PORT')"
          }
        }
      }
    }
    Connection settingMeaning
    hostSend: the receiver's host name or IP. Trigger: the local address to listen on, usually 0.0.0.0. Keep it an @appsetting(...) reference.
    portSend: the receiver's port. Trigger: the listening port, one per receiving workflow.
    startBlock / endBlock / trailerMLLP block characters as hex. Defaults 0x0B / 0x1C / 0x0D; trailer none for no trailer.
    encodingutf-8 (default), any .NET encoding name, or auto to read MSH-18.
    useTls, tlsVersion, tlsCertificate, …See TLS
  3. 3
    Receive with the trigger.

    This workflow answers ADT messages with AA and everything else with AR, like a BizTalk two-way receive location.

    {
      "definition": {
        "triggers": {
          "When_a_message_is_received": {
            "type": "ServiceProvider",
            "inputs": {
              "parameters": {
                "acknowledgementMode": "Workflow",
                "acknowledgementType": "Original",
                "responseTimeoutSeconds": 30,
                "timeoutBehavior": "SendNegativeAck"
              },
              "serviceProviderConfiguration": {
                "connectionName": "mllpListenerAdt",
                "operationId": "receiveMessage",
                "serviceProviderId": "/serviceProviders/lamboHl7Mllp"
              }
            }
          }
        },
        "actions": {
          "Is_ADT": {
            "type": "If",
            "expression": { "equals": [ "@triggerBody()?['messageCode']", "ADT" ] },
            "actions": {
              "Accept": {
                "type": "ServiceProvider",
                "inputs": {
                  "parameters": {
                    "contextId": "@triggerBody()?['contextId']",
                    "ackCode": "AA",
                    "text": "@concat('Processed ', triggerBody()?['messageType'])"
                  },
                  "serviceProviderConfiguration": {
                    "connectionName": "mllpListenerAdt",
                    "operationId": "sendAcknowledgement",
                    "serviceProviderId": "/serviceProviders/lamboHl7Mllp"
                  }
                }
              }
            },
            "else": {
              "actions": {
                "Reject": {
                  "type": "ServiceProvider",
                  "inputs": {
                    "parameters": {
                      "contextId": "@triggerBody()?['contextId']",
                      "ackCode": "AR",
                      "text": "@concat('Unsupported message type ', triggerBody()?['messageType'])",
                      "errorCode": 200
                    },
                    "serviceProviderConfiguration": {
                      "connectionName": "mllpListenerAdt",
                      "operationId": "sendAcknowledgement",
                      "serviceProviderId": "/serviceProviders/lamboHl7Mllp"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "kind": "Stateless"
    }
  4. 4
    Run it locally.

    Start Azurite, build the project, and run func start in bin/Debug/net8.0. No license is needed under Core Tools. Then send a message with the test tool.

Hosting

In Azure, the trigger needs a host that accepts inbound TCP on its port: hybrid deployment or your own container. On App Service plans, receive through the gateway instead; the Send message action works on every plan.