-3

I am new to Apache Camel.

My requirement is to trigger an Apache camel route in my code flow from method A(). Also I need to pass the object param of A() to the route. I do not want to use amq, file etc components.

code :

public void A(MyObjectType param) {
    //Need to call camel route with "param"
}

What's the best way to do this?

2
  • What do you want to do with the route? How is that parameter going to be used?
    – James Fox
    Sep 18, 2014 at 14:12
  • The route will do filtering for a particular use case based on input param object passed and further pass the flow to downstream code. For ex :- The route will check if { inputObjectParam.Customer.Location == 'US' } then route it to Route A else Route it to Route B
    – skpraveen
    Sep 19, 2014 at 5:06

1 Answer 1

2

You can use the ProducerTemplate option, ProducerTemplate template = exchange.getContext().createProducerTemplate() and then you can do template.sendBody The sendBody method can invoke a camel route directly.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.