Hi

Thanks for reporting. Its a little bug, as the value was already a
string type it was not parsed like the others.

I added the missing logic and an unit test
https://issues.apache.org/jira/browse/CAMEL-9124?

On Wed, Sep 9, 2015 at 12:08 PM, Gregor Zurowski
<[email protected]> wrote:
> Further debugging shows that delayPattern never gets properly replaced
> with the value configured with property placeholders, therefore the
> string "{{redelivery.delayPattern}}" is passed into the
> RedeliveryPolicy class as-is and fails during calculation in
> calculateRedeliverDelayUsingPattern on line 246:
>
> long delay = Long.valueOf(ObjectHelper.after(group, ":"));
>
> Any ideas why delayPattern isn't replaced by the property placeholder
> mechanism while other properties of RedeliveryPolicy don't have this
> problem?
>
> Thanks,
> Gregor
>
>
> On Tue, Sep 8, 2015 at 9:50 PM, Gregor Zurowski
> <[email protected]> wrote:
>> Hi everyone:
>>
>> I am trying to configure "delayPattern" in an onException clause as follows:
>>
>> .onException(Exception.class)
>>    .delayPattern("{{redelivery.delayPattern}}")
>>
>> The "redelivery.delayPattern" property is configured in Blueprint like this:
>>
>> <cm:property name="redelivery.delayPattern" value="0:5000" />
>>
>> When an exception is handled, redelivery fails with the following exception:
>>
>> java.lang.NumberFormatException: null
>>         at java.lang.Long.parseLong(Long.java:552)[:1.8.0_51]
>>         at java.lang.Long.valueOf(Long.java:803)[:1.8.0_51]
>>         at 
>> org.apache.camel.processor.RedeliveryPolicy.calculateRedeliverDelayUsingPattern(RedeliveryPolicy.java:246)[141:org.apache.camel.camel-core:2.15.2]
>>         at 
>> org.apache.camel.processor.RedeliveryPolicy.calculateRedeliveryDelay(RedeliveryPolicy.java:205)[141:org.apache.camel.camel-core:2.15.2]
>>         at 
>> org.apache.camel.processor.RedeliveryErrorHandler.determineRedeliveryDelay(RedeliveryErrorHandler.java:504)[141:org.apache.camel.camel-core:2.15.2]
>>         at 
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:394)[141:org.apache.camel.camel-core:2.15.2]
>>
>> The configured property can be logged without issues:
>>
>> .log("delayPattern: {{redelivery.delayPattern}}") => delayPattern: 0:5000
>>
>> Other properties of RedeliveryPolicy, such as "maximumRedeliveries",
>> work without any issues, e.g.:
>>
>> .onException(Exception.class)
>>    .maximumRedeliveries("{{redelivery.maximumRedeliveries}}")
>>
>> I use Camel 2.15.2 on Karaf 3.0.4/ServiceMix 6.0.0.
>>
>> Any ideas why delayPattern can't be configured with property placeholders?
>>
>> Thanks in advance,
>> Gregor



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition

Reply via email to