Package ca.uhn.hl7v2.app
Class Receiver
java.lang.Object
ca.uhn.hl7v2.concurrent.Service
ca.uhn.hl7v2.app.Receiver
- All Implemented Interfaces:
Runnable
Listens for incoming messages on a certain input stream, and sends them to
the appropriate location.
- Author:
- Bryan Tripp
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceHandle any protocol level parsing exceptions and pass them on to an exception handler -
Constructor Summary
ConstructorsConstructorDescriptionReceiver(ActiveConnection c, HL7Reader in) Creates a new instance of Receiver, associated with the given Connection -
Method Summary
Modifier and TypeMethodDescriptionprotected voidhandle()The main task of the thread, called in a loop as long asService.isRunning()returns true.protected voidprocessMessage(String message) Processes a single incoming message by sending it to the appropriate internal location.voidsetParserExeptionHandler(Receiver.ReceiverParserExceptionHandler parserExeptionHandler) Methods inherited from class ca.uhn.hl7v2.concurrent.Service
afterStartup, afterTermination, getExecutorService, getServiceExitedWithException, isRunning, prepareTermination, run, setServiceExitedWithException, setShutdownTimeout, start, startAndWait, stop, stopAndWait, waitForTermination
-
Constructor Details
-
Receiver
Creates a new instance of Receiver, associated with the given Connection
-
-
Method Details
-
setParserExeptionHandler
-
handle
Description copied from class:ServiceThe main task of the thread, called in a loop as long asService.isRunning()returns true. Overridden methods are responsible for yielding or pausing the thread when it's idle. The method must also not block indefinitely so that a call toService.stop()is able to gracefully terminate the thread. -
processMessage
Processes a single incoming message by sending it to the appropriate internal location. If an incoming message contains an MSA-2 field, it is assumed that this message is meant as a reply to a message that has been sent earlier. In this case an attempt is give the message to the object that sent the corresponding outbound message. If the message contains an MSA-2 but there are no objects that appear to be waiting for it, it is discarded and an exception is logged. If the message does not contain an MSA-2 field, it is concluded that the message has arrived unsolicited. In this case it is sent to the Responder (in a new Thread).
-