camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <>
Subject Re: Data-driven routing
Date Wed, 25 Feb 2009 23:12:10 GMT
2009/2/25 jbower1950 <>:
> After working through Camel-Spring-ActiveMQ configuration and a DSL approach
> I am still struggling with the pieces necessary to achieve dynamic,
> data-driven routing for JMS as follows.
> Each "source" (ActiveMQ topic or queue) may have 0-n routes, each defined
> below:
> 1. Optional xpath expression for filtering
> 2. Optional processes
> 3. forwarding of the message to a destination (a different queue or topic)
> The recipientlist pattern is appropriate. However, it does not seem possible
> to use the DSL to assemble the route in pieces, as each recipient must be a
> pipeline of [xpath filter] [0-n processes] and an endpoint. The pieces are
> contained in a JPA result set, so I cannot piece the route together with DSL
> (have to loop to get the syntax.
> I have tried a processor with a producer template, but it does not seem to
> be reliable.
> Any hints?

If I understand what you're saying - you're doing a JPA query to find
all the xpath expressions and processes to execute and you want to
create a route for each combination right?

So something like this...

public class MyRouteBuilder {
// inject JPA resources and whatever else you need with IoC

  public void configure() {
     List<Foo> foos = ... // some query
     for (Foo foo : foos) {
        String u = foo.getFromEndpointUri();
        String xp = foo.getXPath();
        Class type = foo.getBeanType(); // or processor type

        // lets add a route from the uri and filter to the given

i.e. you can use the Java DSL within any regular Java code (loops,
conditional branches and whatnot) plus you can dependency inject your
RouteBuilder with whatever resources it needs (like JPA stuff)


Open Source Integration

View raw message