ca.uhn.hl7v2.app
Class Receiver

java.lang.Object
  extended by ca.uhn.hl7v2.concurrent.Service
      extended by ca.uhn.hl7v2.app.Receiver
All Implemented Interfaces:
Runnable

public class Receiver
extends Service

Listens for incoming messages on a certain input stream, and sends them to the appropriate location.

Author:
Bryan Tripp

Constructor Summary
Receiver(Connection c, HL7Reader in)
          Creates a new instance of Receiver, associated with the given Connection
 
Method Summary
protected  void handle()
          The main task of the thread, called in a loop as long as Service.isRunning() returns true.
protected  void processMessage(String message)
          Processes a single incoming message by sending it to the appropriate internal location.
 
Methods inherited from class ca.uhn.hl7v2.concurrent.Service
afterStartup, afterTermination, getExecutorService, getServiceExitedWithException, isRunning, prepareTermination, run, setServiceExitedWithException, setShutdownTimeout, start, stop, stopAndWait, waitForTermination
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Receiver

public Receiver(Connection c,
                HL7Reader in)
Creates a new instance of Receiver, associated with the given Connection

Method Detail

handle

protected void handle()
Description copied from class: Service
The main task of the thread, called in a loop as long as Service.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 to Service.stop() is able to gracefully terminate the thread.

Specified by:
handle in class Service

processMessage

protected void processMessage(String message)
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).



Copyright © 2001-2012 University Health Network. All Rights Reserved.