如何在使用 Camel MLLP 组件的 Citrus 中发送操作后读取确认

How to read acknowledgement after send action in Citrus with Camel MLLP Component

我有一个应用程序接收 HL7 消息并发回确认响应。我将 Citrus 与 Camel MLLP 组件一起使用来发送此 HL7 消息。我想要实现的是能够阅读确认以进行比较。

我目前正在使用 hl7Payload 进行测试,这是一个包含 HL7 内容的字符串变量。在我的柑橘背景下,我有:

<citrus-camel:sync-endpoint id="mllpOutEndpoint"
                            camel-context="mllpContext"
                            endpoint-uri="mllp:localhost:6662"/>

我尝试提取在 Camel documentation 上找到的 header:

send("mllpOutEndpoint")
    .fork(true)
    .messageType(MessageType.PLAINTEXT)
    .payload(hl7Payload)
    .extractFromHeader("CamelMllpAcknowledgementString", "receivedAck");

echo("${receivedAck}");

但是我得到这个错误:

com.consol.citrus.exceptions.UnknownElementException: Could not find header element CamelMllpAcknowledgementString in received header

没有 extractFromHeader() 一切正常。应用程序收到我的 HL7 消息,发回一个 ACK​​ 并且测试通过,但我正在努力取回此 ACK 内容以进行进一步测试。我在这里错过了什么?

我知道了:

async().actions(
    send("mllpOutEndpoint")
            .messageType(MessageType.PLAINTEXT)
            .payload(hl7Payload),

    receive("mllpOutEndpoint")
            .header("CamelMllpAcknowledgementType", "AA")
);