Browse Source

send Methode um n mailiges senden bis ack empfangen erweitert

master
taschi 10 years ago
parent
commit
d621dc3a1e
1 changed files with 8 additions and 10 deletions
  1. +8
    -10
      src/main/java/de/uniluebeck/mi/projmi6/hapi/HL7Sender.java

+ 8
- 10
src/main/java/de/uniluebeck/mi/projmi6/hapi/HL7Sender.java View File

@@ -8,6 +8,7 @@ import ca.uhn.hl7v2.app.HL7Service;
import ca.uhn.hl7v2.app.Initiator;
import ca.uhn.hl7v2.llp.LLPException;
import ca.uhn.hl7v2.model.Message;
import ca.uhn.hl7v2.model.v251.message.ACK;
import ca.uhn.hl7v2.model.v251.message.ADT_A01;
import ca.uhn.hl7v2.model.v251.segment.*;
import ca.uhn.hl7v2.parser.Parser;
@@ -128,25 +129,22 @@ public class HL7Sender {
Initiator initiator = connection.getInitiator ();
Message response = null;
try {
response = initiator.sendAndReceive ( adt );
while (! (response instanceof ACK)) {
response = initiator.sendAndReceive ( adt );
Thread.sleep ( 5000 );
}
} catch (HL7Exception e) {
e.printStackTrace ();
} catch (LLPException e) {
e.printStackTrace ();
} catch (IOException e) {
e.printStackTrace ();
}
/*
String responseString = null;
try {
responseString = p.encode ( response );
} catch (HL7Exception e) {
} catch (InterruptedException e) {
e.printStackTrace ();
}
System.out.println ( "Received response:\n" + responseString );
*/

/*
/*

* Close the connection when you are done with it.
*/
connection.close ();


Loading…
Cancel
Save