3

I'm working on heath care sort of application using HL7 protocol. in the process we are sending a HL7 message to localhost:50005 using MLLP. Here is the code i used to send Message through 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();
        }

This code is working fine and sending the request to the HL7 Soup UI as intended, as we already setup a HL7 Soup UI instance that is listening on localhost on port 50005. we also setup HL7 soup to send the response as soon as the message is received. but in code we are unable to get response. we are getting the following exception:

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)

i did some R&D and found a link: https://sourceforge.net/p/hl7api/mailman/message/18425561/ and i added timeout code to set some time out so that it get some extra time for response but still getting the same error.

do anyone have some idea of this, thanks in advance.

NoNaMe
  • 6,020
  • 30
  • 82
  • 110

0 Answers0