How to handle [MLLP] acknowledgments using [apache-camel]

Viewed 88

I'm attempting to send a HL7 message between two MLLP apache-camel components:

@Component
public class Producer extends RouteBuilder {

    @Override
    public void configure() {
        from("direct:hl7-recipient")
                .marshal(new HL7DataFormat())
                .to(mllp("localhost:4444"))
                .end();
    }
}

@Component
public class Consumer extends RouteBuilder {

    @Override
    public void configure() {
        from(mllp("localhost:4444"))
                .log("received")
                .unmarshal(new HL7DataFormat())
                .log("unmarshalled")
                .setProperty(MLLP_ACKNOWLEDGEMENT_TYPE, ack(AcknowledgmentCode.AA))
                .log("responding")
                .end();
    }
}

I can see the received, unmarshalled and responding log messages.

The exception that is occurring:

java.net.SocketTimeoutException: Read timed out

With this extract from the stacktrace:

Failed delivery for (MessageId: 0D423F22CDC26D9-0000000000000000 on ExchangeId: 0D423F22CDC26D9-0000000000000000). Exhausted after delivery attempt: 1 caught: org.apache.camel.component.mllp.MllpAcknowledgementTimeoutException: process(0D423F22CDC26D9-0000000000000000) [Socket[addr=localhost/127.0.0.1,port=4444,localport=64357]] - timeout receiving MLLP Acknowledgment

It appears that the acknowledgment is not being returned.

I have been following the apache-camel official documentation by setting the acknowledgment property on the exchange.

Thank you for any support.

0 Answers
Related