Splitter (Justa Messaging Routing)

The Splitter can take a message from a source queue and split it into several smaller messages that can be sent to the target destination queue. For example, a service could send an XML message to a source queue that the Splitter listens on. The Splitter would then use a specified XPath expression to extract all the nodes that match the expression in the incoming XML message. For each node the Splitter would send a new XML message to the specified target destination. Below are the steps required to setup an instance of the Splitter.
  • Define the source queue that the Splitter will consume messages from.
  • Define the target destination queue that the Splitter will send messages to.
  • Specify the Split Action that the Splitter should invoke for each message it consumes from the source queue.
  • Optional, if the Splitter's generic type is XmlDocument, then you can specify an XPath expression and the default static XmlSplit operation as the Split Action.
note: no need to define an expression if the Split Action is not the provided default XmlSplit operation.

splitter.gif

example Split on list of items in an Order object. For each item in the order a new item message is sent to the target destination.
    Splitter<Order> splitter = 
            new Splitter<Order>("src.queue", "dest.queue", 
                    delegate(Order order, string expression) 
                    {
                        return order.Items; 
                    }, String.Empty);



example Split based on the provided XmlSplit operation and specified XPath expression. For each item in the order a new item message is sent to the target destination.
    Splitter<XmlDocument> splitter = 
            new Splitter<XmlDocument>("src.queue", "dest.queue", 
                    Splitter<XmlDocument>.XmlSplit, "/order/items");


for more information on the Asynchronous Messaging Splitter pattern please visit Gregor Hohpe and Bobby Woolf Splitter

Last edited May 11, 2008 at 8:39 AM by aperez, version 9

Comments

No comments yet.