camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <>
Subject [jira] Commented: (CAMEL-3215) @PropertyInjected - An annotation to inject a property from Camel properties
Date Sat, 09 Oct 2010 13:01:40 GMT


Claus Ibsen commented on CAMEL-3215:

We already got @EndpointInjected which we could improve. However I only think it works on
a certain number of field types such as Endpoint, ProducerTemplate. You cannot define it on
any kind of type such as Integer, int etc.

Also we could consider make it more generic so you can evaluate a script such and have the
result converted to the field type.

> @PropertyInjected - An annotation to inject a property from Camel properties
> ----------------------------------------------------------------------------
>                 Key: CAMEL-3215
>                 URL:
>             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.

View raw message