[
https://issues.apache.org/activemq/browse/CAMEL-2631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58994#action_58994
]
Claus Ibsen commented on CAMEL-2631:
------------------------------------
1) Do not use {{new String}} but just {{" xxx"}}
2)
Do not log INFO but do that as TRACE since the type converters can be invoked a
lot.
And use ifTraceEnabled.
3)
I think the return type should be {{Long}} and if the String input does *not*
match any patterns, then you should return {{Void.TYPE}} to indicate you cannot
convert this.
Then Camel will let other type converters try, which for example can be a
String -> Long which can convert "444" to 444 as long value.
4)
Add unit test for bullet #3. Eg to have Camel convert at regular number to a
Long.
And then afterwards have Camel convert "5m2s" to Long to see that it uses your
new type converter
And then try a regular "444" to 444 afterwards to ensure it still works
5)
And could you add an unit test with the timer component that has a {{period}}
option in the URI using your new syntax, eg {{period=2s}} to indicate 2 seconds.
> Add time millis converter which can convert from String to long
> ---------------------------------------------------------------
>
> Key: CAMEL-2631
> URL: https://issues.apache.org/activemq/browse/CAMEL-2631
> Project: Apache Camel
> Issue Type: New Feature
> Components: camel-core
> Reporter: Claus Ibsen
> Assignee: Ashwin Karpe
> Priority: Minor
> Attachments: time-pattern-converter-patch2.diff
>
>
> Its currently a bit annoying to set a delay by millis and if you need, like 1
> hour 30 min period. What is this in millis?
> We should add a TypeConverter for that which has a String notation such as:
> {code}
> 1h30m
> 3h45m25s
> 10m
> 15m20s
> 30s
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.