HAPI-如何提供自定义ApplicationRouter实现

时间:2018-06-19 15:08:46

标签: java router hl7 hapi

HAPI 2.3中捆绑的默认ApplicationRouterImpl在尝试处理无效的消息类型时绝对令人窒息(例如,它获得的定制消息类型只是说ZPM而不是像DFT ^ P03这样的有效消息类型)。我试图修改此行为,因此我建立了一个扩展ApplicationRouterImpl的自定义类。我正在尝试将此类连接到HAPI,但是我不知道在什么对象上使用哪种方法来完成此操作。这是我初始化我认为最可能的候选对象的HapiContext和HL7Service对象的方法:

context = new DefaultHapiContext();
        context.setValidationContext(ValidationContextFactory.noValidation());
        context.getPipeParser().getParserConfiguration().setUnexpectedSegmentBehaviour(UnexpectedSegmentBehaviourEnum.ADD_INLINE);
        ModelClassFactory cmf = new CustomModelClassFactory("com.mdenis.mdhis_common.hl7.custommodel");
        context.setModelClassFactory(cmf);

usageServer = context.newServer(port, false);
        usageServer.startAndWait();

        ReceivingApplication handler = this;
        usageServer.registerApplication("DFT", "P03", handler);
        usageServer.registerConnectionListener(this);

谢谢!

0 个答案:

没有答案