Joe Luo created CAMEL-11010:
-------------------------------

             Summary: Failed to set delayPattern using property placeholder in 
redeliveryPolicy tag
                 Key: CAMEL-11010
                 URL: https://issues.apache.org/jira/browse/CAMEL-11010
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.15.1
            Reporter: Joe Luo


Setting "delayPattern" using property placeholder in <redeliveryPolicy> tag 
does not work. 

Here is my camel route:
{code}
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
        xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0";
        xmlns:camel="http://camel.apache.org/schema/blueprint"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
                            http://camel.apache.org/schema/blueprint 
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd";>

    <cm:property-placeholder id="properties" 
persistent-id="org.apache.camel.test">
        <cm:default-properties>
            <cm:property name="delayPattern" value="1:1000;2:2000;3:3000" />
            <cm:property name="maxDeliveries" value="3" />
        </cm:default-properties>
    </cm:property-placeholder>

    <bean id="ex" class="java.lang.IllegalStateException" />

    <camelContext id="redeliveryTestContext" trace="true" 
xmlns="http://camel.apache.org/schema/blueprint"; >
                <onException useOriginalMessage="false">
            <exception>java.lang.IllegalStateException</exception>
                        <redeliveryPolicy delayPattern="{{delayPattern}}"
                    maximumRedeliveries="{{maxDeliveries}}"
                    retryAttemptedLogLevel="WARN" logRetryAttempted="true" />
            <handled>
                <constant>true</constant>
            </handled>
            <to uri="log:org.apache.camel.test?level=DEBUG" />
        </onException>

        <route id="startExceptionTest">
            <from uri="timer://foo?repeatCount=1" />
            <setBody>
                <constant>Hello Camel!</constant>
            </setBody>
            <filter>
                <simple>'{{maxDeliveries}}' == 3</simple>
                <throwException ref="ex" />
            </filter>
        </route>
    </camelContext>
</blueprint>
{code}

The error I got:
{quote}
10:48:37,344 | WARN  | #2 - timer://foo | DefaultErrorHandler              | 
198 - org.apache.camel.camel-core - 2.15.1.redhat-621084 | Failed delivery for 
(MessageId: ID-jluomac-57289-1489488438889-1-1 on ExchangeId: 
ID-jluomac-57289-1489488438889-1-2). On delivery attempt: 0 caught: 
java.lang.IllegalStateException
10:48:37,345 | WARN  | #2 - timer://foo | TimerConsumer                    | 
198 - org.apache.camel.camel-core - 2.15.1.redhat-621084 | Error processing 
exchange. This exception will be ignored, to let the timer be able to trigger 
again.
java.lang.NumberFormatException: null
        at java.lang.Long.parseLong(Long.java:404)\[:1.7.0_67]
        at java.lang.Long.valueOf(Long.java:540)\[:1.7.0_67]
        at 
org.apache.camel.processor.RedeliveryPolicy.calculateRedeliverDelayUsingPattern(RedeliveryPolicy.java:246)\[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
        at 
org.apache.camel.processor.RedeliveryPolicy.calculateRedeliveryDelay(RedeliveryPolicy.java:205)\[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
        at 
org.apache.camel.processor.RedeliveryErrorHandler.determineRedeliveryDelay(RedeliveryErrorHandler.java:504)\[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
        at 
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:394)\[198:org.apache.camel.camel-core:2.15.1.redhat-621084]
...
{quote}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to