ca.uhn.hl7v2.app
Class Receiver

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

public class Receiver
extends java.lang.Object
implements java.lang.Runnable

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 processMessage(java.lang.String message)
          Processes a single incoming message by sending it to the appropriate internal location.
 void run()
          Loops continuously, reading messages and calling processMessage() until stop() is called.
 void start()
          Starts the Receiver in a new thread
 void stop()
          Stops the Receiver after the next message is read.
 
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

run

public void run()
Loops continuously, reading messages and calling processMessage() until stop() is called.

Specified by:
run in interface java.lang.Runnable

processMessage

protected void processMessage(java.lang.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).


start

public void start()
Starts the Receiver in a new thread


stop

public void stop()
Stops the Receiver after the next message is read.



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