Thursday, April 21, 2011

ActiveMQ & Camel - How to create dependency in routing paths

I have a message routing to implement, which has routes that vary according to the message content. Some strands of the route are dependent on other.

If for example I have Data_A which has Task_A and Task_B to be performed on it. Whereas Data_B has only Task_B to be performed on it.

Here each Task has a queue served by consumers.

If Task_A should be performed only after Task_B if Task_B is requested on the data, how do I set-up such dependencies?

From stackoverflow
  • You can use several routes to branch out the workflow, like this

    from("queue:start").
      choice().xpath("//foo")).to("queue:taskB").
      otherwise().to("queue:taskA");
    
    from("queue:taskB").process(new DoTaskB()).to("queue:taskA");
    
    from("queue:taskA").process(new DoTaskA()).to("queue:done");
    

0 comments:

Post a Comment