Hi

For background see CAMEL-895 and this thread by James
http://www.nabble.com/-2.0--simplifying-annotations%2C-DSL-and-XML-to-remove-uri-%2B-ref--tp20775864s22882p20775864.html

Motivation
=======
Currently the URI configuration of camel endpoints is used a lot. It's
fast, precise and intuitive for end-users. And it supports most of
their use-cases.
The URI options is given as string parameters just like http. Camel
will then parse this and type convert and call the correct setter on
the concrete xxxEndpoint object.
Camel can do the traditional type converts for numeric, boolean,
string, enum and what not. However the problem is...

The problem
=========
That we can not set complex objects on endpoint using URI options.
Each individual component need to add special code to support this and
it's irritating me. Why can't we do it smarter.
And if we do it smarter then we get this out-of-the-box so suddenly
*all* components support this.

The idea
======
The idea is to support the # syntax for URI options (I think Apache
CXF has this as well).

So if you want to set a complex object type on a given endpoint you
can refer to a bean in the registry using the # notation. An example:
     file://inbox/?idempotent=true&idempotentRepository=#myJpaRepo

Then end users can configure the myJapRepo in the Spring XML using
standard spring bean ids.

Benefits
======
- It's easy for end users as they can look at the xxEndpoint and see
which properties it has (setters). And they can use the # notation to
set it for complex objects as well.
- When you add options to an endpoint you get this notation for free,
no need to add special code to the xxxComponent to do the lookup
yourself
- Even some options on default endpoints is now exposed and
configurable, such as the executorService
- We can reduce existing code
- Easier for end users to understand that # is for regestry lookup
instead of inventing our own custom names such as:
idempotentRepositoryRef
- And as a real bonus we don't have to wiki document the special
options idempotentRepositoryRef. We get all this for free with # so we
can just document the idempotentRepository option

Any thoughts?


/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/

Reply via email to