Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

So you can if you prefer configure your Component using an IoC framework like Spring or Guice; then add it to the CamelContext. Or you can let the Component auto-inject itself as the endpoints are auto-discovered.

Options

If your component has options you can let it have public getters/setters and Camel will automatically set the properties when the endpoint is created. If you however takes the matter in your own hand, then you must remove the option from the given parameter list as Camel will validate that all options are used. If not Camel will thrown a ResolveEndpointFailedException stating some of the options are unknown.

The parameters is provided by Camel in the createEndpoint method from DefaultComponent:

Code Block

protected abstract Endpoint<E> createEndpoint(String uri, String remaining, Map parameters)

The code is an example from the SEDA component that removes the size parameter:

Code Block

    public BlockingQueue<Exchange> createQueue(String uri, Map parameters) {
        int size = 1000;
        Object value = parameters.remove("size");
        if (value != null) {
            Integer i = convertTo(Integer.class, value);
            if (i != null) {
                size = i;
            }
        }
        return new LinkedBlockingQueue<Exchange>(size);
    }

See Also