@PropertyInjected - An annotation to inject a property from Camel properties
----------------------------------------------------------------------------
Key: CAMEL-3215
URL: https://issues.apache.org/activemq/browse/CAMEL-3215
Project: Apache Camel
Issue Type: New Feature
Components: camel-core
Affects Versions: 2.4.0
Reporter: Claus Ibsen
Priority: Minor
Fix For: Future
This is just an idea. Suppose you have a RouteBuilder in Java DSL and you need
a timeout value to be defined in a properties file
{code}
aggregateTimeout=20000
{code}
And then you want to use this timeout value in the RouteBuilder
{code}
from("xxx").aggregate(header("group"),
myStrategy).completionTimeout(timeout).to("zzz");
{code}
The problem is that the DSL requires the timeout to be an integer because that
makes sense. So we can't use the property placeholder directly in the DSL as
its a String type.
eg. the following is *not* possible
{code}
from("xxx").aggregate(header("group"),
myStrategy).completionTimeout("{{aggregationTimeout}}").to("zzz");
{code}
What we may need is to inject the timeout value in the RouteBuilder in a field
{code}
@PropertyInjected("aggregationTimeout")
private int timeout;
{code}
The @PropertyInjected annotation tells Camel to go look for the
aggregationTimeout property and convert the value to the same type of the
field, which is an int.
Now you can use that value in the Java DSL
There may be other or standard annotations/injections possible.
Any though?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.