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())