---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    funktion.fabric8.io/kind: Connector
  name: mllp
data:
  deployment.yml: |
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      labels:
        funktion.fabric8.io/kind: Subscription
        connector: mllp
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            funktion.fabric8.io/kind: Subscription
            connector: mllp
        spec:
          containers:
          - image: funktion/connector-mllp:${project.version}
            name: connector
  schema.yml: |
    ---
    component:
      kind: component
      scheme: mllp
      syntax: mllp:hostname:port
      title: MLLP
      description: The MLLP component is designed to handle the MLLP protocol and provide the functionality required by Healthcare providers to communicate with other systems using the MLLP protocol.
      label: mllp
      deprecated: false
      async: false
      javaType: org.apache.camel.component.mllp.MllpComponent
      groupId: org.apache.camel
      artifactId: camel-mllp
      version: 2.18.3
    componentProperties: {}
    properties:
      hostname:
        kind: path
        group: common
        required: true
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Hostname or IP for connection for the TCP connection. The default value is null which means any local IP address
        order: 0
      port:
        kind: path
        group: common
        required: true
        type: integer
        javaType: int
        deprecated: false
        secret: false
        description: Port number for the TCP connection
        order: 1
      autoAck:
        kind: parameter
        group: common
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: true
        description: Enable/Disable the automatic generation of a MLLP Acknowledgement MLLP Consumers only
        order: 2
      bufferWrites:
        kind: parameter
        group: common
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: true
        description: Enable/Disable the validation of HL7 Payloads If enabled MLLP Payloads are buffered and written to the external system in a single write(byte) operation. If disabled the MLLP payload will not be buffered and three write operations will be used. The first operation will write the MLLP start-of-block character 0x0b (ASCII VT) the second operation will write the HL7 payload and the third operation will writh the MLLP end-of-block character and the MLLP end-of-data character 0x1c 0x0d (ASCII FS CR).
        order: 3
      hl7Headers:
        kind: parameter
        group: common
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: true
        description: Enable/Disable the automatic generation of message headers from the HL7 Message MLLP Consumers only
        order: 4
      keepAlive:
        kind: parameter
        group: common
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: true
        description: Enable/disable the SO_KEEPALIVE socket option.
        order: 5
      reuseAddress:
        kind: parameter
        group: common
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: Enable/disable the SO_REUSEADDR socket option.
        order: 6
      tcpNoDelay:
        kind: parameter
        group: common
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: true
        description: Enable/disable the TCP_NODELAY socket option.
        order: 7
      validatePayload:
        kind: parameter
        group: common
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: 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.
        order: 8
      bridgeErrorHandler:
        kind: parameter
        group: consumer
        label: consumer
        type: boolean
        javaType: boolean
        optionalPrefix: consumer.
        deprecated: false
        secret: false
        defaultValue: false
        description: Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
        order: 9
      exceptionHandler:
        kind: parameter
        group: consumer (advanced)
        label: consumer,advanced
        type: object
        javaType: org.apache.camel.spi.ExceptionHandler
        optionalPrefix: consumer.
        deprecated: false
        secret: false
        description: To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
        order: 10
      exchangePattern:
        kind: parameter
        group: consumer (advanced)
        label: consumer,advanced
        type: string
        javaType: org.apache.camel.ExchangePattern
        enum:
        - InOnly
        - RobustInOnly
        - InOut
        - InOptionalOut
        - OutOnly
        - RobustOutOnly
        - OutIn
        - OutOptionalIn
        deprecated: false
        secret: false
        description: Sets the exchange pattern when the consumer creates an exchange.
        order: 11
      backlog:
        kind: parameter
        group: advanced
        label: advanced
        type: integer
        javaType: int
        deprecated: false
        secret: false
        defaultValue: "5"
        description: 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.
        order: 12
      receiveBufferSize:
        kind: parameter
        group: advanced
        label: advanced
        type: integer
        javaType: java.lang.Integer
        deprecated: false
        secret: false
        description: Sets the SO_RCVBUF option to the specified value (in bytes)
        order: 13
      sendBufferSize:
        kind: parameter
        group: advanced
        label: advanced
        type: integer
        javaType: java.lang.Integer
        deprecated: false
        secret: false
        description: Sets the SO_SNDBUF option to the specified value (in bytes)
        order: 14
      synchronous:
        kind: parameter
        group: advanced
        label: advanced
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
        order: 15
      charsetName:
        kind: parameter
        group: codec
        label: codec
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Set the CamelCharsetName property on the exchange
        order: 16
      acceptTimeout:
        kind: parameter
        group: timeout
        label: timeout
        type: integer
        javaType: int
        deprecated: false
        secret: false
        defaultValue: "60000"
        description: Timeout (in milliseconds) while waiting for a TCP connection TCP Server Only
        order: 17
      bindRetryInterval:
        kind: parameter
        group: timeout
        label: timeout
        type: integer
        javaType: int
        deprecated: false
        secret: false
        defaultValue: "5000"
        description: TCP Server Only - The number of milliseconds to wait between bind attempts
        order: 18
      bindTimeout:
        kind: parameter
        group: timeout
        label: timeout
        type: integer
        javaType: int
        deprecated: false
        secret: false
        defaultValue: "30000"
        description: TCP Server Only - The number of milliseconds to retry binding to a server port
        order: 19
      connectTimeout:
        kind: parameter
        group: timeout
        label: timeout
        type: integer
        javaType: int
        deprecated: false
        secret: false
        defaultValue: "30000"
        description: Timeout (in milliseconds) for establishing for a TCP connection TCP Client only
        order: 20
      maxReceiveTimeouts:
        kind: parameter
        group: timeout
        label: timeout
        type: integer
        javaType: int
        deprecated: false
        secret: false
        defaultValue: -1
        description: The maximum number of timeouts (specified by receiveTimeout) allowed before the TCP Connection will be reset.
        order: 21
      readTimeout:
        kind: parameter
        group: timeout
        label: timeout
        type: integer
        javaType: int
        deprecated: false
        secret: false
        defaultValue: "500"
        description: The SO_TIMEOUT value (in milliseconds) used after the start of an MLLP frame has been received
        order: 22
      receiveTimeout:
        kind: parameter
        group: timeout
        label: timeout
        type: integer
        javaType: int
        deprecated: false
        secret: false
        defaultValue: "10000"
        description: The SO_TIMEOUT value (in milliseconds) used when waiting for the start of an MLLP frame
        order: 23
  documentation.adoc: |+
    [[Mllp-MllpComponent]]
    MLLP Component
    ~~~~~~~~~~~~~~

    *available as of Camel 2.17*

    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 acknowledgement 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 an standard Java Sockets. This keeps the implementation simple
    and eliminates the dependencies other than Camel itself.

    The component supports the following:

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

    The MLLP component uses byte[] payloads, and relies on Camel Type
    Conversion to convert byte[] to other types.  

    Maven users will need to add the following dependency to their pom.xml
    for this component:

    [source,xml]
    ---------------------------------------------------------
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-mllp</artifactId>
        <version>x.x.x</version>
        <!-- use the same version as your Camel core version -->
    </dependency>
    ---------------------------------------------------------

    [[MLLP-MLLPOptions]]
    MLLP Options
    ~~~~~~~~~~~~



    // component options: START
    The MLLP component has no options.
    // component options: END








    // endpoint options: START
    The MLLP component supports 24 endpoint options which are listed below:

    {% raw %}
    [width="100%",cols="2,1,1m,1m,5",options="header"]
    |=======================================================================
    | Name | Group | Default | Java Type | Description
    | hostname | common |  | String | *Required* Hostname or IP for connection for the TCP connection. The default value is null which means any local IP address
    | port | common |  | int | *Required* Port number for the TCP connection
    | autoAck | common | true | boolean | Enable/Disable the automatic generation of a MLLP Acknowledgement MLLP Consumers only
    | bufferWrites | common | true | boolean | Enable/Disable the validation of HL7 Payloads If enabled MLLP Payloads are buffered and written to the external system in a single write(byte) operation. If disabled the MLLP payload will not be buffered and three write operations will be used. The first operation will write the MLLP start-of-block character 0x0b (ASCII VT) the second operation will write the HL7 payload and the third operation will writh the MLLP end-of-block character and the MLLP end-of-data character 0x1c 0x0d (ASCII FS CR).
    | hl7Headers | common | true | boolean | Enable/Disable the automatic generation of message headers from the HL7 Message MLLP Consumers only
    | keepAlive | common | true | boolean | Enable/disable the SO_KEEPALIVE socket option.
    | reuseAddress | common | false | boolean | Enable/disable the SO_REUSEADDR socket option.
    | tcpNoDelay | common | true | boolean | Enable/disable the TCP_NODELAY socket option.
    | validatePayload | common | false | boolean | 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.
    | bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
    | exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
    | exchangePattern | consumer (advanced) |  | ExchangePattern | Sets the exchange pattern when the consumer creates an exchange.
    | backlog | advanced | 5 | int | 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.
    | receiveBufferSize | advanced |  | Integer | Sets the SO_RCVBUF option to the specified value (in bytes)
    | sendBufferSize | advanced |  | Integer | Sets the SO_SNDBUF option to the specified value (in bytes)
    | synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
    | charsetName | codec |  | String | Set the CamelCharsetName property on the exchange
    | acceptTimeout | timeout | 60000 | int | Timeout (in milliseconds) while waiting for a TCP connection TCP Server Only
    | bindRetryInterval | timeout | 5000 | int | TCP Server Only - The number of milliseconds to wait between bind attempts
    | bindTimeout | timeout | 30000 | int | TCP Server Only - The number of milliseconds to retry binding to a server port
    | connectTimeout | timeout | 30000 | int | Timeout (in milliseconds) for establishing for a TCP connection TCP Client only
    | maxReceiveTimeouts | timeout | -1 | int | The maximum number of timeouts (specified by receiveTimeout) allowed before the TCP Connection will be reset.
    | readTimeout | timeout | 500 | int | The SO_TIMEOUT value (in milliseconds) used after the start of an MLLP frame has been received
    | receiveTimeout | timeout | 10000 | int | The SO_TIMEOUT value (in milliseconds) used when waiting for the start of an MLLP frame
    |=======================================================================
    {% endraw %}
    // endpoint options: END







    [[MLLP-MLLPConsumer]]
    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.

    [[MLLP-MessageHeaders]]
    *Message Headers*
    ^^^^^^^^^^^^^^^^^

    The MLLP Consumer adds these headers on the Camel message:

    [width="100%",cols="<34%,<33%,<33%",]
    |===========================================
    |*Key* |*MSH field* |*Example*
    |CamelMllpLocalAddress |  | 
    |CamelMllpRemoteAddress |  | 
    |CamelMllpSendingApplication |MSH-3 |APPA
    |CamelMllpSendingFacility |MSH-4 |FACA
    |CamelMllpReceivingApplication |MSH-5 |CAMEL
    |CamelMllpReceivingFacility |MSH-6 |FACB
    |CamelMllpTimestamp |MSH-7 |20150106235900
    |CamelMllpSecurity |MSH-8 | 
    |CamelMllpMessageType |MSH-9 |ADT^A04
    |CamelMllpEventType |MSH-9-1 |AD4
    |CamelMllpTriggerEvent |MSH-9-2 |A04
    |CamelMllpMessageControlId |MSH-10 |12345
    |CamelMllpProcessingId |MSH-11 |P
    |CamelMllpVersionId |MSH-12 |2.3.1
    |CamelMllpCharset |MSH-18 | 
    |===========================================

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

    [[MLLP-ExchangeProperties]]
    *Exchange Properties*
    ^^^^^^^^^^^^^^^^^^^^^

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

    [width="100%",cols="<34%,<33%,<33%",]
    |====================================
    |*Key* |  |*Example*
    |CamelMllpAcknowledgement |  | 
    |CamelMllpAcknowledgementType |  | AR
    |====================================

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

    [[MLLP-ConsumerConfiguration]]
    Consumer Configuration
    ^^^^^^^^^^^^^^^^^^^^^^

    [[MLLP-MLLPProducer]]
    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.

    [[MLLP-MessageHeaders.1]]
    *Message Headers*
    ^^^^^^^^^^^^^^^^^

    The MLLP Producer adds these headers on the Camel message:

    [width="100%",cols="<34%,<33%,<33%",]
    |===================================
    |*Key* |*MSH field* |*Example*
    |CamelMllpLocalAddress |  | 
    |CamelMllpRemoteAddress |  | 
    |CamelMllpAcknowledgement |  | 
    |CamelMllpAcknowledgementType |  |AA
    |===================================

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



