You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2010/10/09 15:01:40 UTC

[jira] Commented: (CAMEL-3215) @PropertyInjected - An annotation to inject a property from Camel properties

    [ https://issues.apache.org/activemq/browse/CAMEL-3215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=62477#action_62477 ] 

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: 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.