149.12. HL7 Acknowledgement 表达式
HL7v2 处理中的常见任务是生成确认消息,作为响应传入的 HL7v2 消息,如基于验证结果。ack
表达式让我们可以完美地完成这一目的:
import static org.apache.camel.component.hl7.HL7.messageConformsTo; import static org.apache.camel.component.hl7.HL7.ack; import ca.uhn.hl7v2.validation.impl.DefaultValidation; // Use standard or define your own validation rules ValidationContext defaultContext = new DefaultValidation(); from("direct:test1") .onException(Exception.class) .handled(true) .transform(ack()) // auto-generates negative ack because of exception in Exchange .end() .validate(messageConformsTo(defaultContext)) // do something meaningful here // acknowledgement .transform(ack())