net.sf.xbus.application
Class Router

java.lang.Object
  extended by net.sf.xbus.application.Router

public class Router
extends java.lang.Object

The Router routes a message to one or more systems. Three different strategies are implemented:

Configuration:

Chapter Section Key Content
Router message.getSource() + "." + message.getFunction() Invoken System where a message is sent to and from which a response is returned.
Router message.getSource() + "." + message.getFunction() Distributen System where a message is sent to and from which no response is returned.


Field Summary
static java.lang.String CHAPTER
           
 
Constructor Summary
Router()
           
 
Method Summary
 void distribute(Message message)
          The Message is distributed to one or more systens.
 void invoke(Message message)
          A chain of invocations of one or more senders.
 void invokeAndDistribute(Message message)
          A combination of invoke and distribute.
 void route(Message message)
          The message will be routed depending on the entries of the configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHAPTER

public static final java.lang.String CHAPTER
See Also:
Constant Field Values
Constructor Detail

Router

public Router()
Method Detail

route

public void route(Message message)
           throws XException
The message will be routed depending on the entries of the configuration.

Parameters:
message - the request data of this Message is sent to the first system. It's response data is empty afterwards because the last step is the distribution without responses.
Throws:
XException

distribute

public void distribute(Message message)
                throws XException
The Message is distributed to one or more systens. This means, that the given Message is sent to the systems (read from the Configuration) one after the other. Because there is no response data from the systems awaited, the response data in the Message is empty after the distribution.

If an error occurs when calling one sender, the processing stops, a rollback is done and the returncode of the Message is set to RC_NOK.

Parameters:
message - the request data of this Message is sent to the systems
Throws:
XException

invokeAndDistribute

public void invokeAndDistribute(Message message)
                         throws XException
A combination of invoke and distribute. First the data goes through a chain of sender invocations, then the response data of the last sender is distributed to one or more systems.

If an error occurs when calling one sender, the processing stops, a rollback is done and the returncode of the Message is set to RC_NOK.

Parameters:
message - the request data of this Message is sent to the first system. It's response data is empty afterwards because the last step is the distribution without responses.
Throws:
XException

invoke

public void invoke(Message message)
            throws XException
A chain of invocations of one or more senders. After a sender has been called, the Message for the next sender is created with the response data of the previous sender. After the invocation of the last sender, the response data of the initial Message is filled with the response data of the last sender.

If an error occurs when calling one sender, the processing stops, a rollback is done and the returncode of the initial Message is set to RC_NOK.

Parameters:
message - the initial Message
Throws:
XException