Camel SE and wire-tap EIP

Working on the Open ESB Camel SE, developing a more real world content-based-routing example, the new example now provides some logging.

By using the multiple String argument form of to (Fluent Builders Java DSL) I was able to have some POJOs get control before and after a message was sent to a target BPEL process.

PORouter3/PORouter/PORouterCamelJBIModule/src:
org/camelse/examples/porouter/AppRouteBuilder.java
  // Routes based on expression evaluation
  //(POJOs write messages to log)
  from(jbiInURI).
    choice().
      when(orderPriceGT500).
        to("bean:LogPOJO1", jbiBpel2DbURI,"bean:LogPOJO1").
     otherwise().
        to("bean:LogPOJO2", jbiBpel2FileURI,"bean:LogPOJO2");

Each POJO logs the message with the POJO’s name (so I can see which route was taken).  This is a slightly different approach to Apache Camel’s wire-tap EIP.

The order in which the messages appear within the log (and the timestamps) distinguish before from after for each POJO.

Category: camel se, open source, open-esb

Posted by: Mike Wright on: October 24, 2008

Tags:

Namespace-aware Camel routing

The early Open ESB Camel SE examples use a simple input message with an Apache Camel Enterprise Integration Patterns (EIPs) content-based-routing XPath expression.

I needed to work on a more realistic example involving messages with namespace qualified elements, so I updated the routing logic to pass a Map of namespaces to the XPathBuilder before configuring Fluent Builders Java DSL content-based-routing.

  // Sets up a namespace-qualified XPath expression
  XPathBuilder orderPriceGT500 =
    new XPathBuilder("//po:OrderInfo/po:OrderPrice > 500");
  Map nsm = new HashMap();
  nsm.put("po", "http://www.globalcompany.com/ns/order");
  orderPriceGT500.setNamespaces(nsm);

and:

  // Routes based on expression evaluation
  from(jbiInURI).choice().when(orderPriceGT500).to(jbiBpel2DbURI).
    otherwise().to(jbiBpel2FileURI);

Category: camel se, open source, open-esb

Posted by: Mike Wright on: October 23, 2008

Tags: