java - Apache Camel - What is the difference between <camel:bean and <camel:to -


i have route data mq , have sequence below xml:

<camel:bean ref="instruction_handler" method="save"/> <camel:to ref="instruction_handler" /> 

both execute sequentially, difference can notice first line calls method "save" , second 1 calls method annotated "@handler", looks no other behavior difference.

you can use bean component route , can use beanref. documentation of bean component: http://camel.apache.org/bean.html

so camel:bean , camel:to both invoking bean. in case in first call you've specified method invoke, in second call haven't specified name of method invoke, camel choose method using following rules (in case method decorated @handler): http://camel.apache.org/bean-binding.html#beanbinding-choosingthemethodtoinvoke


Comments