|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.osesb.msgrouting.MessageRouter
public class MessageRouter
MessageRouter(s) are configured by transport handlers to route incoming messages to org.osesb.messagepipeline.MessagePipeline(s) for processing. Transport handlers are Message Driven and Stateless Session Beans configured to receive messages over JMS and SOAP, respectively. See the 'transport-handler' module. So, transport handlers configure pools of MessageRouter(s) during ejbCreate(), where bean instances obtain a MessageRouter from the configured pool in order to route an incoming XML message. See org.osesb.objectpools.MessageRouterPoolFactory.
MessageRouter(s) are also configured by ClientGateway(s) in order to facilitate communication with broker end points such as JMS Queues and web services. Broker end-points are exposed by osESB transport handlers. Each ClientGateway instance configures a single MessageRouter. Pooling for ClientGateway resources is at the ClientGateway level, not the router level. See org.osesb.objectpools.ClientGatewayKeyedPoolFactory. MessageRouter(s) route messages to org.osesb.messagepipeline.MessagePipeline(s) for processing. The following discussion relates to transport handler usage. See org.osesb.msgrouting.ClientGateway for comments on how a MessageRouter is configured by a ClientGateway. Transport handlers invoke routeEAIMessage() with a org.osesb.eaimessage.EAIMessage that encapsulates the content and meta-data for the incoming message. XML, with or without attachments, is expected as the message content and message meta-data includes:<messagetype-to-messagepipeline-map> configuration
element of a MessageRouterConfiguration to map message types
to MessagePipelines.
See the org.osesb.messagepipeline package.
See the org.osesb.transporthandlers package in the transport-handlers module.
There are two ways that the message type for an incoming message
is determined:
<xmlMessagetypeHelperConfiguration> content model element of the
MessageRouterConfiguration.
MessageRouter(s)can be pooled. See org.osesb.objectpools.MessageRouterPoolFactory.
| Field Summary | |
|---|---|
protected static org.apache.commons.logging.Log |
log
The logging implementation for this class. |
protected MessageRouterConfiguration |
messageRouterConfiguration
The MessageRouterConfiguration that this MessageRouter is constructed with. |
protected java.lang.String |
thisClassName
The full name of this class. |
protected AbstractXMLMessageTypeHelper |
xmlMessageTypeHelper
XMLMessageTypeHelper that extracts message types from XML text. |
| Constructor Summary | |
|---|---|
MessageRouter(MessageRouterConfiguration messageRouterConfiguration)
Creates a new instance of a MessageRouter with a MessageRouterConfiguration that includes: A XMLMessageTypeXPathExpressionListConfiguration, which configures XPath expressions that resolve to message types. A XMLMappedConfiguration that maps message types to the MessagePipelines that are configured to process incoming messages. |
|
| Method Summary | |
|---|---|
MessageRouterConfiguration |
getMessageRouterConfiguration()
Return the MessageRouterConfiguration for this MessageRouter. |
javax.xml.namespace.QName |
getMessageType(java.lang.String xmlMessageText)
Returns the message type for the given XML message using the XMLMessageTypeHelper configured by the <xmlMessagetypeHelperConfiguration>
configuration element of the MessageRouterConfiguration. |
protected AbstractXMLMessageTypeHelper |
loadXMLMessageTypeHelper()
Loads the configured XMLMessageTypeHelper from the <xmlMessagetypeHelperConfiguration> content model element
of the MessageRouterConfiguration. |
static void |
main(java.lang.String[] args)
main() For testing and sandboxing. |
EAIMessage |
routeEAIMessage(EAIMessage eaiMessage)
Route a EAIMessage to a MessagePipeline for processing and possibly return a result as an EAIMessage. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static org.apache.commons.logging.Log log
protected java.lang.String thisClassName
protected MessageRouterConfiguration messageRouterConfiguration
protected AbstractXMLMessageTypeHelper xmlMessageTypeHelper
loadXMLMessageTypeHelper(),
getMessageType(String xmlMessageText)| Constructor Detail |
|---|
public MessageRouter(MessageRouterConfiguration messageRouterConfiguration)
throws java.lang.Exception
messageRouterConfiguration - A MessageRouterConfiguration
java.lang.Exception - if construction fails.| Method Detail |
|---|
public EAIMessage routeEAIMessage(EAIMessage eaiMessage)
throws PipelineStageException,
java.lang.Exception
eaiMessage - The EAIMessage to route.
PipelineStageException - if an error occurs while running the destination MessagePipeline.
java.lang.Exception - if any error other than a PipelineStageException occurs.
public javax.xml.namespace.QName getMessageType(java.lang.String xmlMessageText)
throws java.lang.Exception,
MessageTypeNotFoundException
<xmlMessagetypeHelperConfiguration>
configuration element of the MessageRouterConfiguration.
DefaultXMLMessageTypeHelper is the default XMLMessageTypeHelper class and
is constructed with a XMLMessageTypeXPathExpressionListConfiguration.
DefaultXMLMessageTypeHelper applies the configured XPath expressions to a
XML message until a messageType is determined.
DefaultXMLMessageTypeHelper#getMessagetype() returns the messageType as a QName,
where the namespaceURI is the XML document namespace (if any) and the localPart
is the value for the element or attribute that is given by a XPath expression.
To configure a MessageRouter with a different XMLMessageTypeHelper, create a
class that extends AbstractXMLMessageTypeHelper and use the
<xmlMessagetypeHelperConfiguration> content model element of the
MessageRouterConfiguration.
xmlMessageText - The XML to extract the message type from.
java.lang.Exception - if a general error occurs.
MessageTypeNotFoundException - if the message type cannot be determined.
protected AbstractXMLMessageTypeHelper loadXMLMessageTypeHelper()
throws java.lang.Exception
<xmlMessagetypeHelperConfiguration> content model element
of the MessageRouterConfiguration.
Example <xmlMessagetypeHelperConfiguration> content model:
<xmlMessagetypeHelperConfiguration>
<!-- The MessagetypeHelper class. -->
<helper-class>org.osesb.msgrouting.test.CustomTestXMLMessageTypeHelper_Test2</helper-class>
<!--
A fully qualified helper configuration class name is optional.
If <helper-config> is empty, then this element is not used.
If <helper-config> is not empty, then the specified class is
constructed from the <helper-config> element. If <helper-config>
is not empty and this element is not specified, then a XMLConfiguration
is constructed from the <helper-config> element.
If a helper configuration is constructed, then it is passed
to the constructor of the <helper-class> when the helper class
is constructed by MessageRouter.
-->
<helper-config-class>org.osesb.msgrouting.configuration.XMLMessageTypeXPathExpressionListConfiguratio</helper-config-class>
<helper-config>...</helper-config>
</xmlMessagetypeHelperConfiguration>
java.lang.Exception - if there is an error constructing a XMLMessageTypeHelper.getMessageType(String xmlMessageText)public MessageRouterConfiguration getMessageRouterConfiguration()
public static void main(java.lang.String[] args)
args - commandline arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||