Package com.framed.interop.hl7.mllp
Class MllpServer
java.lang.Object
com.framed.interop.hl7.mllp.MllpServer
- All Implemented Interfaces:
Closeable,AutoCloseable
MLLP server (the message responder): listens for connections, reads each framed HL7 message and
replies with the acknowledgement produced by the supplied handler.
Each connection is serviced on its own thread and may carry multiple messages. The accept loop runs on a daemon thread started in the constructor.
-
Constructor Summary
ConstructorsConstructorDescriptionMllpServer(int port, UnaryOperator<String> handler) Binds and starts accepting connections immediately. -
Method Summary
-
Constructor Details
-
MllpServer
Binds and starts accepting connections immediately.- Parameters:
port- the port to bind (0for an ephemeral port; seegetPort())handler- maps a received HL7 message to the acknowledgement to send back- Throws:
IOException- if the socket cannot be bound
-
-
Method Details
-
getPort
public int getPort()- Returns:
- the actual bound port (useful when constructed with port 0).
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
