Rechercher

Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 92. MLLP

download PDF

Both producer and consumer are supported

The MLLP component is specifically designed to handle the nuances of the MLLP protocol and provide the functionality required by Healthcare providers to communicate with other systems using the MLLP protocol.

The MLLP component provides a simple configuration URI, automated HL7 acknowledgment generation and automatic acknowledgment interrogation.

The MLLP protocol does not typically use a large number of concurrent TCP connections - a single active TCP connection is the normal case. Therefore, the MLLP component uses a simple thread-per-connection model based on standard Java Sockets. This keeps the implementation simple and eliminates the dependencies on only Camel itself.

The component supports the following:

  • A Camel consumer using a TCP Server
  • A Camel producer using a TCP Client

The MLLP component use byte[] payloads, and relies on Camel type conversion to convert byte[] to other types.

92.1. Dependencies

When using mllp with Red Hat build of Camel Spring Boot make sure to use the following Maven dependency to have support for auto configuration:

<dependency>
  <groupId>org.apache.camel.springboot</groupId>
  <artifactId>camel-mllp-starter</artifactId>
</dependency>

92.2. Configuring Options

Camel components are configured on two levels:

  • Component level
  • Endpoint level

92.2.1. Component Level Options

The component level is the highest level. The configurations you define at this level are inherited by all the endpoints. For example, a component can have security settings, credentials for authentication, urls for network connection, and so on.

Since components typically have pre-configured defaults for the most common cases, you may need to only configure a few component options, or maybe none at all.

You can configure components with Component DSL in a configuration file (application.properties|yaml), or directly with Java code.

92.2.2. Endpoint Level Options

At the Endpoint level you have many options, which you can use to configure what you want the endpoint to do. The options are categorized according to whether the endpoint is used as a consumer (from) or as a producer (to) or used for both.

You can configure endpoints directly in the endpoint URI as path and query parameters. You can also use Endpoint DSL and DataFormat DSL as type safe ways of configuring endpoints and data formats in Java.

When configuring options, use Property Placeholders for urls, port numbers, sensitive information, and other settings.

Placeholders allows you to externalize the configuration from your code, giving you more flexible and reusable code.

92.3. Component Options

The MLLP component supports 30 options, which are listed below.

NameDescriptionDefaultType

autoAck (common)

Enable/Disable the automatic generation of a MLLP Acknowledgement MLLP Consumers only.

true

boolean

charsetName (common)

Sets the default charset to use.

 

String

configuration (common)

Sets the default configuration to use when creating MLLP endpoints.

 

MllpConfiguration

hl7Headers (common)

Enable/Disable the automatic generation of message headers from the HL7 Message MLLP Consumers only.

true

boolean

requireEndOfData (common)

Enable/Disable strict compliance to the MLLP standard. The MLLP standard specifies START_OF_BLOCKhl7 payloadEND_OF_BLOCKEND_OF_DATA, however, some systems do not send the final END_OF_DATA byte. This setting controls whether or not the final END_OF_DATA byte is required or optional.

true

boolean

stringPayload (common)

Enable/Disable converting the payload to a String. If enabled, HL7 Payloads received from external systems will be validated converted to a String. If the charsetName property is set, that character set will be used for the conversion. If the charsetName property is not set, the value of MSH-18 will be used to determine th appropriate character set. If MSH-18 is not set, then the default ISO-8859-1 character set will be use.

true

boolean

validatePayload (common)

Enable/Disable the validation of HL7 Payloads If enabled, HL7 Payloads received from external systems will be validated (see Hl7Util.generateInvalidPayloadExceptionMessage for details on the validation). If and invalid payload is detected, a MllpInvalidMessageException (for consumers) or a MllpInvalidAcknowledgementException will be thrown.

false

boolean

acceptTimeout (consumer)

Timeout (in milliseconds) while waiting for a TCP connection TCP Server Only.

60000

int

backlog (consumer)

The maximum queue length for incoming connection indications (a request to connect) is set to the backlog parameter. If a connection indication arrives when the queue is full, the connection is refused.

5

Integer

bindRetryInterval (consumer)

TCP Server Only - The number of milliseconds to wait between bind attempts.

5000

int

bindTimeout (consumer)

TCP Server Only - The number of milliseconds to retry binding to a server port.

30000

int

bridgeErrorHandler (consumer)

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to receive incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. If disabled, the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions by logging them at WARN or ERROR level and ignored.

true

boolean

lenientBind (consumer)

TCP Server Only - Allow the endpoint to start before the TCP ServerSocket is bound. In some environments, it may be desirable to allow the endpoint to start before the TCP ServerSocket is bound.

false

boolean

maxConcurrentConsumers (consumer)

The maximum number of concurrent MLLP Consumer connections that will be allowed. If a new connection is received and the maximum is number are already established, the new connection will be reset immediately.

5

int

reuseAddress (consumer)

Enable/disable the SO_REUSEADDR socket option.

false

Boolean

exchangePattern (consumer (advanced))

Sets the exchange pattern when the consumer creates an exchange.

Enum values:

  • InOnly
  • InOut
  • InOptionalOut

InOut

ExchangePattern

connectTimeout (producer)

Timeout (in milliseconds) for establishing for a TCP connection TCP Client only.

30000

int

idleTimeoutStrategy (producer)

decide what action to take when idle timeout occurs. Possible values are : RESET: set SO_LINGER to 0 and reset the socket CLOSE: close the socket gracefully default is RESET.

Enum values:

  • RESET
  • CLOSE

RESET

MllpIdleTimeoutStrategy

keepAlive (producer)

Enable/disable the SO_KEEPALIVE socket option.

true

Boolean

lazyStartProducer (producer)

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

boolean

tcpNoDelay (producer)

Enable/disable the TCP_NODELAY socket option.

true

Boolean

autowiredEnabled (advanced)

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

true

boolean

defaultCharset (advanced)

Set the default character set to use for byte to/from String conversions.

ISO-8859-1

String

logPhi (advanced)

Whether to log PHI.

true

Boolean

logPhiMaxBytes (advanced)

Set the maximum number of bytes of PHI that will be logged in a log entry.

5120

Integer

readTimeout (advanced)

The SO_TIMEOUT value (in milliseconds) used after the start of an MLLP frame has been received.

5000

int

receiveBufferSize (advanced)

Sets the SO_RCVBUF option to the specified value (in bytes).

8192

Integer

receiveTimeout (advanced)

The SO_TIMEOUT value (in milliseconds) used when waiting for the start of an MLLP frame.

15000

int

sendBufferSize (advanced)

Sets the SO_SNDBUF option to the specified value (in bytes).

8192

Integer

idleTimeout (tcp)

The approximate idle time allowed before the Client TCP Connection will be reset. A null value or a value less than or equal to zero will disable the idle timeout.

 

Integer

92.4. Endpoint Options

The MLLP endpoint is configured using URI syntax:

mllp:hostname:port

with the following path and query parameters:

92.4.1. Path Parameters (2 parameters)

NameDescriptionDefaultType

hostname (common)

Required Hostname or IP for connection for the TCP connection. The default value is null, which means any local IP address.

 

String

port (common)

Required Port number for the TCP connection.

 

int

92.4.2. Query Parameters (26 parameters)

NameDescriptionDefaultType

autoAck (common)

Enable/Disable the automatic generation of a MLLP Acknowledgement MLLP Consumers only.

true

boolean

charsetName (common)

Sets the default charset to use.

 

String

hl7Headers (common)

Enable/Disable the automatic generation of message headers from the HL7 Message MLLP Consumers only.

true

boolean

requireEndOfData (common)

Enable/Disable strict compliance to the MLLP standard. The MLLP standard specifies START_OF_BLOCKhl7 payloadEND_OF_BLOCKEND_OF_DATA, however, some systems do not send the final END_OF_DATA byte. This setting controls whether or not the final END_OF_DATA byte is required or optional.

true

boolean

stringPayload (common)

Enable/Disable converting the payload to a String. If enabled, HL7 Payloads received from external systems will be validated converted to a String. If the charsetName property is set, that character set will be used for the conversion. If the charsetName property is not set, the value of MSH-18 will be used to determine th appropriate character set. If MSH-18 is not set, then the default ISO-8859-1 character set will be use.

true

boolean

validatePayload (common)

Enable/Disable the validation of HL7 Payloads If enabled, HL7 Payloads received from external systems will be validated (see Hl7Util.generateInvalidPayloadExceptionMessage for details on the validation). If and invalid payload is detected, a MllpInvalidMessageException (for consumers) or a MllpInvalidAcknowledgementException will be thrown.

false

boolean

acceptTimeout (consumer)

Timeout (in milliseconds) while waiting for a TCP connection TCP Server Only.

60000

int

backlog (consumer)

The maximum queue length for incoming connection indications (a request to connect) is set to the backlog parameter. If a connection indication arrives when the queue is full, the connection is refused.

5

Integer

bindRetryInterval (consumer)

TCP Server Only - The number of milliseconds to wait between bind attempts.

5000

int

bindTimeout (consumer)

TCP Server Only - The number of milliseconds to retry binding to a server port.

30000

int

bridgeErrorHandler (consumer)

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to receive incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. If disabled, the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions by logging them at WARN or ERROR level and ignored.

true

boolean

lenientBind (consumer)

TCP Server Only - Allow the endpoint to start before the TCP ServerSocket is bound. In some environments, it may be desirable to allow the endpoint to start before the TCP ServerSocket is bound.

false

boolean

maxConcurrentConsumers (consumer)

The maximum number of concurrent MLLP Consumer connections that will be allowed. If a new connection is received and the maximum is number are already established, the new connection will be reset immediately.

5

int

reuseAddress (consumer)

Enable/disable the SO_REUSEADDR socket option.

false

Boolean

exceptionHandler (consumer (advanced))

To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored.

 

ExceptionHandler

exchangePattern (consumer (advanced))

Sets the exchange pattern when the consumer creates an exchange.

Enum values:

  • InOnly
  • InOut
  • InOptionalOut

InOut

ExchangePattern

connectTimeout (producer)

Timeout (in milliseconds) for establishing for a TCP connection TCP Client only.

30000

int

idleTimeoutStrategy (producer)

decide what action to take when idle timeout occurs. Possible values are : RESET: set SO_LINGER to 0 and reset the socket CLOSE: close the socket gracefully default is RESET.

Enum values:

  • RESET
  • CLOSE

RESET

MllpIdleTimeoutStrategy

keepAlive (producer)

Enable/disable the SO_KEEPALIVE socket option.

true

Boolean

lazyStartProducer (producer)

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

boolean

tcpNoDelay (producer)

Enable/disable the TCP_NODELAY socket option.

true

Boolean

readTimeout (advanced)

The SO_TIMEOUT value (in milliseconds) used after the start of an MLLP frame has been received.

5000

int

receiveBufferSize (advanced)

Sets the SO_RCVBUF option to the specified value (in bytes).

8192

Integer

receiveTimeout (advanced)

The SO_TIMEOUT value (in milliseconds) used when waiting for the start of an MLLP frame.

15000

int

sendBufferSize (advanced)

Sets the SO_SNDBUF option to the specified value (in bytes).

8192

Integer

idleTimeout (tcp)

The approximate idle time allowed before the Client TCP Connection will be reset. A null value or a value less than or equal to zero will disable the idle timeout.

 

Integer

92.5. MLLP Consumer

The MLLP Consumer supports receiving MLLP-framed messages and sending HL7 Acknowledgements. The MLLP Consumer can automatically generate the HL7 Acknowledgement (HL7 Application Acknowledgements only - AA, AE and AR), or the acknowledgement can be specified using the CamelMllpAcknowledgement exchange property. Additionally, the type of acknowledgement that will be generated can be controlled by setting the CamelMllpAcknowledgementType exchange property. The MLLP Consumer can read messages without sending any HL7 Acknowledgement if the automatic acknowledgement is disabled and exchange pattern is InOnly.

92.5.1. Message Headers

The MLLP Consumer adds these headers on the Camel message:

Key

Description

CamelMllpLocalAddress

The local TCP Address of the Socket

CamelMllpRemoteAddress

The local TCP Address of the Socket

CamelMllpSendingApplication

MSH-3 value

CamelMllpSendingFacility

MSH-4 value

CamelMllpReceivingApplication

MSH-5 value

CamelMllpReceivingFacility

MSH-6 value

CamelMllpTimestamp

MSH-7 value

CamelMllpSecurity

MSH-8 value

CamelMllpMessageType

MSH-9 value

CamelMllpEventType

MSH-9-1 value

CamelMllpTriggerEvent

MSH-9-2 value

CamelMllpMessageControlId

MSH-10 value

CamelMllpProcessingId

MSH-11 value

CamelMllpVersionId

MSH-12 value

CamelMllpCharset

MSH-18 value

All headers are String types. If a header value is missing, its value is null.

92.5.2. Exchange Properties

The type of acknowledgment the MLLP Consumer generates and state of the TCP Socket can be controlled by these properties on the Camel exchange:

KeyTypeDescription

CamelMllpAcknowledgement

byte[]

If present, this property will we sent to client as the MLLP Acknowledgement

CamelMllpAcknowledgementString

String

If present and CamelMllpAcknowledgement is not present, this property will we sent to client as the MLLP Acknowledgement

CamelMllpAcknowledgementMsaText

String

If neither CamelMllpAcknowledgement or CamelMllpAcknowledgementString are present and autoAck is true, this property can be used to specify the contents of MSA-3 in the generated HL7 acknowledgement

CamelMllpAcknowledgementType

String

If neither CamelMllpAcknowledgement or CamelMllpAcknowledgementString are present and autoAck is true, this property can be used to specify the HL7 acknowledgement type (i.e. AA, AE, AR)

CamelMllpAutoAcknowledge

Boolean

Overrides the autoAck query parameter

CamelMllpCloseConnectionBeforeSend

Boolean

If true, the Socket will be closed before sending data

CamelMllpResetConnectionBeforeSend

Boolean

If true, the Socket will be reset before sending data

CamelMllpCloseConnectionAfterSend

Boolean

If true, the Socket will be closed immediately after sending data

CamelMllpResetConnectionAfterSend

Boolean

If true, the Socket will be reset immediately after sending any data

92.6. MLLP Producer

The MLLP Producer supports sending MLLP-framed messages and receiving HL7 Acknowledgements. The MLLP Producer interrogates the HL7 Acknowledgments and raises exceptions if a negative acknowledgement is received. The received acknowledgement is interrogated and an exception is raised in the event of a negative acknowledgement. The MLLP Producer can ignore acknowledgements when configured with InOnly exchange pattern.

92.6.1. Message Headers

The MLLP Producer adds these headers on the Camel message:

KeyDescription

CamelMllpLocalAddress

The local TCP Address of the Socket

CamelMllpRemoteAddress

The remote TCP Address of the Socket

CamelMllpAcknowledgement

The HL7 Acknowledgment byte[] received

CamelMllpAcknowledgementString

The HL7 Acknowledgment received, converted to a String

92.6.2. Exchange Properties

The state of the TCP Socket can be controlled by these properties on the Camel exchange:

KeyTypeDescription

CamelMllpCloseConnectionBeforeSend

Boolean

If true, the Socket will be closed before sending data

CamelMllpResetConnectionBeforeSend

Boolean

If true, the Socket will be reset before sending data

CamelMllpCloseConnectionAfterSend

Boolean

If true, the Socket will be closed immediately after sending data

CamelMllpResetConnectionAfterSend

Boolean

If true, the Socket will be reset immediately after sending any data

92.7. Spring Boot Auto-Configuration

The component supports 31 options, which are listed below.

NameDescriptionDefaultType

camel.component.mllp.accept-timeout

Timeout (in milliseconds) while waiting for a TCP connection TCP Server Only.

60000

Integer

camel.component.mllp.auto-ack

Enable/Disable the automatic generation of a MLLP Acknowledgement MLLP Consumers only.

true

Boolean

camel.component.mllp.autowired-enabled

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

true

Boolean

camel.component.mllp.backlog

The maximum queue length for incoming connection indications (a request to connect) is set to the backlog parameter. If a connection indication arrives when the queue is full, the connection is refused.

5

Integer

camel.component.mllp.bind-retry-interval

TCP Server Only - The number of milliseconds to wait between bind attempts.

5000

Integer

camel.component.mllp.bind-timeout

TCP Server Only - The number of milliseconds to retry binding to a server port.

30000

Integer

camel.component.mllp.bridge-error-handler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to receive incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. If disabled, the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions by logging them at WARN or ERROR level and ignored.

true

Boolean

camel.component.mllp.charset-name

Sets the default charset to use.

 

String

camel.component.mllp.configuration

Sets the default configuration to use when creating MLLP endpoints. The option is a org.apache.camel.component.mllp.MllpConfiguration type.

 

MllpConfiguration

camel.component.mllp.connect-timeout

Timeout (in milliseconds) for establishing for a TCP connection TCP Client only.

30000

Integer

camel.component.mllp.default-charset

Set the default character set to use for byte to/from String conversions.

ISO-8859-1

String

camel.component.mllp.enabled

Whether to enable auto configuration of the mllp component. This is enabled by default.

 

Boolean

camel.component.mllp.exchange-pattern

Sets the exchange pattern when the consumer creates an exchange.

 

ExchangePattern

camel.component.mllp.hl7-headers

Enable/Disable the automatic generation of message headers from the HL7 Message MLLP Consumers only.

true

Boolean

camel.component.mllp.idle-timeout

The approximate idle time allowed before the Client TCP Connection will be reset. A null value or a value less than or equal to zero will disable the idle timeout.

 

Integer

camel.component.mllp.idle-timeout-strategy

decide what action to take when idle timeout occurs. Possible values are : RESET: set SO_LINGER to 0 and reset the socket CLOSE: close the socket gracefully default is RESET.

 

MllpIdleTimeoutStrategy

camel.component.mllp.keep-alive

Enable/disable the SO_KEEPALIVE socket option.

true

Boolean

camel.component.mllp.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.mllp.lenient-bind

TCP Server Only - Allow the endpoint to start before the TCP ServerSocket is bound. In some environments, it may be desirable to allow the endpoint to start before the TCP ServerSocket is bound.

false

Boolean

camel.component.mllp.log-phi

Whether to log PHI.

true

Boolean

camel.component.mllp.log-phi-max-bytes

Set the maximum number of bytes of PHI that will be logged in a log entry.

5120

Integer

camel.component.mllp.max-concurrent-consumers

The maximum number of concurrent MLLP Consumer connections that will be allowed. If a new connection is received and the maximum is number are already established, the new connection will be reset immediately.

5

Integer

camel.component.mllp.read-timeout

The SO_TIMEOUT value (in milliseconds) used after the start of an MLLP frame has been received.

5000

Integer

camel.component.mllp.receive-buffer-size

Sets the SO_RCVBUF option to the specified value (in bytes).

8192

Integer

camel.component.mllp.receive-timeout

The SO_TIMEOUT value (in milliseconds) used when waiting for the start of an MLLP frame.

15000

Integer

camel.component.mllp.require-end-of-data

Enable/Disable strict compliance to the MLLP standard. The MLLP standard specifies START_OF_BLOCKhl7 payloadEND_OF_BLOCKEND_OF_DATA, however, some systems do not send the final END_OF_DATA byte. This setting controls whether or not the final END_OF_DATA byte is required or optional.

true

Boolean

camel.component.mllp.reuse-address

Enable/disable the SO_REUSEADDR socket option.

false

Boolean

camel.component.mllp.send-buffer-size

Sets the SO_SNDBUF option to the specified value (in bytes).

8192

Integer

camel.component.mllp.string-payload

Enable/Disable converting the payload to a String. If enabled, HL7 Payloads received from external systems will be validated converted to a String. If the charsetName property is set, that character set will be used for the conversion. If the charsetName property is not set, the value of MSH-18 will be used to determine th appropriate character set. If MSH-18 is not set, then the default ISO-8859-1 character set will be use.

true

Boolean

camel.component.mllp.tcp-no-delay

Enable/disable the TCP_NODELAY socket option.

true

Boolean

camel.component.mllp.validate-payload

Enable/Disable the validation of HL7 Payloads If enabled, HL7 Payloads received from external systems will be validated (see Hl7Util.generateInvalidPayloadExceptionMessage for details on the validation). If and invalid payload is detected, a MllpInvalidMessageException (for consumers) or a MllpInvalidAcknowledgementException will be thrown.

false

Boolean

Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.