2

我正在使用 HL7 协议开发医疗保健类应用程序。在此过程中,我们使用 MLLP 向 localhost:50005 发送 HL7 消息。这是我用来通过 MLLP 发送消息的代码。

//sending message through mllp
                    PipeParser pipeParser = new PipeParser();
                    pipeParser.setValidationContext(new NoValidation());
                    System.out.println(hl7message);
                    Message message1 = pipeParser.parse(hl7message);
                    ConnectionHub connectionHub =  ConnectionHub.getInstance();
                    Connection conn = null;
                    if (conn == null) {
                        conn = connectionHub.attach(ehrHost, ehrPort, new PipeParser(), MinLowerLayerProtocol.class);
                    }
                    Message response;
                    try {
                        int timeout = 150000;
//                      System.setProperty("ca.uhn.hl7v2.app.initiator.timeout",  Integer.toString(timeout));
                        Initiator init = conn.getInitiator();
                        init.setTimeoutMillis(timeout);
                        response = init.sendAndReceive(message1);
                    } catch (Exception e) {
                        System.out.println("Didn't send out this message!");
                        e.printStackTrace();
        }

此代码工作正常,并按预期将请求发送到 HL7 Soup UI,因为我们已经设置了一个 HL7 Soup UI 实例,该实例在端口 50005 上侦听 localhost。我们还设置了 HL7 Soup 以在消息出现后立即发送响应已收到。但在代码中我们无法得到响应。我们得到以下异常:

ca.uhn.hl7v2.HL7Exception: Timeout waiting for response to message with control ID 20171115-000009
 After Exceuter..................................
    at ca.uhn.hl7v2.app.Initiator.sendAndReceive(Initiator.java:152)
    at com.prnreferral.outbound.MLLPOutboundServiceMain$1.run(MLLPOutboundServiceMain.java:173)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

我做了一些研发并找到了一个链接:https ://sourceforge.net/p/hl7api/mailman/message/18425561/我添加了超时代码来设置一些超时,以便它有一些额外的时间来响应但仍然得到同样的错误。

有没有人对此有所了解,在此先感谢。

4

0 回答 0