Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/368.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java HAPI-如何允许处理MSH-9中只有1个组件的消息类型_Java_Validation_Parsing_Hapi - Fatal编程技术网

Java HAPI-如何允许处理MSH-9中只有1个组件的消息类型

Java HAPI-如何允许处理MSH-9中只有1个组件的消息类型,java,validation,parsing,hapi,Java,Validation,Parsing,Hapi,我正在构建一个应用程序,该应用程序与一个系统接口,该系统只为库存类型事务发送ZPM消息类型。它还发送DFT^P03类型的计费事务,我的系统非常乐意处理这些事务。但是,当它接收到ZPM消息时,默认管道解析器绝对会爆炸并引发以下异常: ca.uhn.hl7v2.HL7Exception: Can't determine message structure from MSH-9: ZPM HINT: there are only 1 of 3 components present at ca.uhn.

我正在构建一个应用程序,该应用程序与一个系统接口,该系统只为库存类型事务发送ZPM消息类型。它还发送DFT^P03类型的计费事务,我的系统非常乐意处理这些事务。但是,当它接收到ZPM消息时,默认管道解析器绝对会爆炸并引发以下异常:

ca.uhn.hl7v2.HL7Exception: Can't determine message structure from MSH-9: ZPM HINT: there are only 1 of 3 components present
at ca.uhn.hl7v2.parser.PipeParser.getStructure(PipeParser.java:186)
at ca.uhn.hl7v2.parser.PipeParser.doParse(PipeParser.java:223)
at ca.uhn.hl7v2.parser.GenericParser.doParse(GenericParser.java:245)
at ca.uhn.hl7v2.parser.Parser.parse(Parser.java:212)
at ca.uhn.hl7v2.parser.GenericParser.parse(GenericParser.java:253)
at ca.uhn.hl7v2.protocol.impl.ApplicationRouterImpl.processMessage(ApplicationRouterImpl.java:138)
at ca.uhn.hl7v2.protocol.impl.ApplicationRouterImpl.processMessage(ApplicationRouterImpl.java:105)
at ca.uhn.hl7v2.app.Responder.processMessage(Responder.java:91)
at ca.uhn.hl7v2.app.Receiver$Grunt.run(Receiver.java:127)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
我可以通过自定义将ZPM消息映射到DFT_P03来解决这个问题,但这是一个我想取消的部署步骤。此外,库存信息不是金融交易,因此这是非常黑客的。以下是我初始化HAPI上下文的方式:

ModelClassFactory cmf = new 
CustomModelClassFactory("com.something.some_lib.hl7.custommodel");

MinLowerLayerProtocol mllp = new MinLowerLayerProtocol();
mllp.setCharset(StandardCharsets.ISO_8859_1.name());

hapiContext = new DefaultHapiContext();
hapiContext.setValidationContext(ValidationContextFactory.noValidation());
hapiContext.getPipeParser()
    .getParserConfiguration()
    .setUnexpectedSegmentBehaviour(
        UnexpectedSegmentBehaviourEnum.ADD_INLINE);
hapiContext.setModelClassFactory(cmf);
hapiContext.setLowerLayerProtocol(mllp);

有没有办法让这些信息通过?

对此有什么想法?我已经创建了一个ZPM^ZPM消息类,如果我能提供一个定制的PipeParser扩展,在解析之前插入消息,并将MSH-9更改为ZPM^ZPM,这将解决问题!