camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Cranton <>
Subject URI references to Objects in the Registry
Date Thu, 14 Feb 2013 12:38:51 GMT
I've just noticed the reference syntax that some components use, but
its not clear to me exactly how it works, and more importantly how new
components are supposed to use it correctly... I don't see any
documentation on it, and I've only found some mentions of it in the
JIRA where it was created and in the camel code itself.

Sorry if I missed an earlier thread on this, but I couldn't find it...

It looks like Camel will resolve "#name" values for endpoint uri
properties to the a Registry id instance.

<bean id="bar" class=""/>

<to uri="someEndpoint:foo?objectProperty=#bar" />

The above syntax will set the Component's configuration, internally
resolving "#bar" to the bean instance from the Camel Registry...

setObjectProperty( value)

I'm also seeing some cases where it looks like there is magic if you
suffix a property name with "Ref" that will do the same thing...

<to uri="someEndpoint:foo?objectPropertyRef=bar"/>

I assume its the same base Component and Endpoint code that's
resolving this, but I can't find it (yet)...

The confusing bit is that some Processors and Component doc use
different conventions...

It looks like an effort was made to normalize this convention around
version 2.2 or 2.3 timeframe, hence some of the inconsistencies... My
question is what is the current "best practice" and/or what would we
like the convention, both in code and in doc, for version 3

BTW: I like the reference syntax, but it did take me a bit to figure
out "is this a Spring thing" or "Camel magic", and "is it just '#name'
that is magic and/or is suffixing with Ref magic", etc.


View raw message