[ 
https://issues.apache.org/jira/browse/CAMEL-24410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-24410:
--------------------------------
    Fix Version/s: 4.22.1
                   4.23.0

> camel-jbang export fails to parse redeliveryDelay in YAML DSL 
> (IllegalArgumentException: Error parsing as java.time.Duration)
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24410
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24410
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jbang
>    Affects Versions: 4.22.0
>         Environment: *Environment*
> * *Camel version:* 4.22.0
> * *Tool:* Camel JBang
> * *DSL:* YAML
>            Reporter: Marat Gubaidullin
>            Assignee: Omar Atie
>            Priority: Critical
>             Fix For: 4.22.1, 4.23.0
>
>
> *Summary*
> `camel export` fails to parse `redeliveryDelay` in YAML DSL 
> (`IllegalArgumentException: Error parsing as java.time.Duration`)
> *Description*
> When defining an `errorHandler` with a `redeliveryDelay` inside a 
> `routeConfiguration` using the YAML DSL, the route executes correctly with 
> `camel run`. However, `camel export` fails to parse the string value, 
> attempting to strictly evaluate it as a `java.time.Duration` and missing the 
> necessary type converter.
> This contradicts the behavior of `camel run` and the definition in 
> `camelYamlDsl.json`, which specifies `redeliveryDelay` as a string 
> representing milliseconds.
> [camelYamlDsl.json|https://github.com/apache/camel/blob/1a54683f4becad3b32df42507e709526d8563f35/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json#L5142-L5147]
> {code:java}
> "redeliveryDelay" : {
> "type" : "string",
> "title" : "Redelivery Delay",
> "description" : "Sets the initial delay in milliseconds before the first 
> redelivery attempt.",
> "default" : "1000"
> },
> {code}
> *Steps to Reproduce*
> *1. Create a YAML route (`xxx.camel.yaml`):*
> {code:java}
> - routeConfiguration:
>     errorHandler:
>       id: errorHandlerf23c
>       deadLetterChannel:
>         id: deadLetterChannelda61
>         deadLetterUri: direct:defaultDLQ
>         redeliveryPolicy:
>           id: redeliveryPolicybe2a
>           maximumRedeliveries: 0
>           redeliveryDelay: "500"
> {code}
> *2. Run the route (Succeeds):*
> {code:java}
> jbang "-Dcamel.jbang.version=4.22.0" camel@apache/camel run *
> {code}
> *3. Export the route (Fails):*
> {code:java}
> jbang "-Dcamel.jbang.version=4.22.0" camel@apache/camel export * --dir=.export
> {code}
> *Actual Error Stack*
> {code:java}
> org.apache.camel.FailedToCreateRouteException: Failed to create route: 
> route-error-handler at: >>> Log[exchangeProperties.CamelExceptionCaught] <<< 
> in route: Route(route-error-handler)[From[direct:defaultDLQ] -> [Log[e... 
> because: java.lang.IllegalArgumentException: Error parsing [500] as a 
> java.time.Duration.
> ...
> Caused by: org.apache.camel.NoTypeConversionAvailableException: No type 
> converter available to convert from type: java.lang.String to the required 
> type: java.time.Duration
>       at 
> org.apache.camel.impl.converter.CoreTypeConverterRegistry.mandatoryConvertTo(CoreTypeConverterRegistry.java:208)
> {code}
> *Expected Behavior*
> `camel export` should successfully parse `"500"` as milliseconds and generate 
> the export project without throwing a `NoTypeConversionAvailableException`, 
> matching the behavior of `camel run`.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to