...
In Camel terms a binding is a way of wrapping an Endpoint in a contract; such as a Data Format, a Transformation Content Enricher or validation step. Bindings are completely optional and you can choose to use them on any camel endpoint.
Bindings are inspired by the work of SwitchYard project(http://www.jboss.org/switchyard) adding service contracts to various technologies like Camel and many others. But rather than the SwitchYard approach of wrapping Camel in SCA, Camel Bindings provide a way of wrapping Camel endpoints with contracts inside the Camel framework itself; so you can use them easily inside any Camel route.
...
You can prefix any endpoint URI with binding:nameOfBinding: where nameOfBinding is the name of the Binding bean in your registry.
Code Block |
---|
from("binding:jaxb:activemq:myQueue").to("binding:jaxb:activemq:anotherQueue")
|
...
For example if you registered a new component called "jsonmq" in your registry using code like this
Code Block |
---|
JacksonDataFormat format = new JacksonDataFormat(MyBean.class);
context.bind("jsonmq", new BindingComponent(new DataFormatBinding(format), "activemq:foo."));
|
Then you could use the endpoint as if it were any other endpoint.
Code Block |
---|
from("jsonmq:myQueue").to("jsonmq:anotherQueue")
|
which This would be using use the queueus queues "foo.myQueue" and "foo.anotherQueue" and would use the given Jackson Data Format to marshal on and off the queue.
...