...
You can then register your component explicitly via
...
However you can use the auto-discovery feature of Camel where by Camel will automatically add a Component when an endpoint URI is used. To do this you would create a file called
...
...
with contents
...
...
(you can add other property configurations in there too if you like)
Then if you refer to an endpoint as foo://somethingOrOther
Camel will auto-discover your component and register it.
The The FooComponent
can then be auto-injected with resources using the Injector, such as to support Spring based auto-wiring, or to support support @Resource
(EJB3 style) injection or Guice style style @Inject
injection.
Working with Spring XML
You can configure a component via Spring using the following mechanism...
...
...
Which allows you to configure a component using some name (activemq in the above example), then you can refer to the component using activemq:[queue:|topic:]destinationName
.
If you want to add explicit Spring 2.x XML objects to your XML then you could use the the xbean-spring
which tries to automate most of the XML binding work for you; or you could look in camel-spring at at CamelNamespaceHandler
you'll see how we handle the Spring XML stuff (warning its kinda hairy code to look at . If you wanted wanted <fooComponent>
to be a standard part of the core Camel schema then you'd hack that file to add your component & conftribute a patch to the camel XSD. Otherwise you could write your own namespace & schema if you prefer.
See Also
- Writing Components
- How do I configure endpointsDo I Configure Endpoints?