ca.uhn.hl7v2.app
Class MessageTypeRouter

java.lang.Object
  extended by ca.uhn.hl7v2.app.MessageTypeRouter
All Implemented Interfaces:
Application

public class MessageTypeRouter
extends java.lang.Object
implements Application

Routes messages to various Applications based on message type and trigger event. The router is told which Application to which to route various messages by calling the method registerApplication(...).

Author:
Bryan Tripp

Constructor Summary
MessageTypeRouter()
          Creates a new instance of MessageTypeRouter
 
Method Summary
 boolean canProcess(Message in)
          Returns true if at least one application has been registered to accept this type of message.
 Message processMessage(Message in)
          Forwards the given message to any Applications that have been registered to accept messages of that type and trigger event.
 void registerApplication(java.lang.String messageType, java.lang.String triggerEvent, Application handler)
          Registers the given application to handle messages corresponding to the given type and trigger event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageTypeRouter

public MessageTypeRouter()
Creates a new instance of MessageTypeRouter

Method Detail

canProcess

public boolean canProcess(Message in)
Returns true if at least one application has been registered to accept this type of message. Applications are registered using registerApplication(...).

Specified by:
canProcess in interface Application

processMessage

public Message processMessage(Message in)
                       throws ApplicationException
Forwards the given message to any Applications that have been registered to accept messages of that type and trigger event.

Specified by:
processMessage in interface Application
Throws:
ApplicationException - if no such Applications are registered, or if the underlying Application throws this exception during processing.

registerApplication

public void registerApplication(java.lang.String messageType,
                                java.lang.String triggerEvent,
                                Application handler)
Registers the given application to handle messages corresponding to the given type and trigger event. Only one application can be registered for a given message type and trigger event combination. A repeated registration for a particular combination of type and trigger event over-writes the previous one. Use "*" as a wildcard (e.g. registerApplication("ADT", "*", myApp) would register your app for all ADT messages).



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