[
https://issues.apache.org/jira/browse/CAMEL-27526?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-27526 started by Claus Ibsen.
-------------------------------------------
> camel-base - type converters from String to OffsetDateTime, ZonedDateTime and
> Instant, so endpoint options of these types can be set in a URI
> ---------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27526
> URL: https://issues.apache.org/jira/browse/CAMEL-27526
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.24.0
>
>
> Endpoint options typed with a java.time type cannot be set in an endpoint URI
> or as a property: there is no type converter from String to OffsetDateTime,
> ZonedDateTime or Instant, so such a URI fails at startup with "No type
> converter available to convert from type: java.lang.String to the required
> type: java.time.OffsetDateTime". Only a bean reference (#bean) works.
> The options affected on main:
> ||Component||Option||Type||
> |azure-servicebus|scheduledEnqueueTime|OffsetDateTime|
> |azure-storage-blob|changeFeedStartTime, changeFeedEndTime|OffsetDateTime|
> |minio|modifiedSince, unModifiedSince|ZonedDateTime|
> |aws2-cw|timestamp|Instant|
> |dapr|workflowStartTime|Instant|
> h3. Proposal
> Add String -> OffsetDateTime, ZonedDateTime and Instant converters to
> DateTimeConverter in camel-base, next to the String -> TimeZone / TimeUnit
> converters and DurationConverter:
> * ISO-8601 only (OffsetDateTime.parse, ZonedDateTime.parse, Instant.parse);
> an empty string converts to null.
> * A space is read as '+': in an endpoint URI the '+' of a positive offset
> (2026-11-18T23:00:00+01:00) is decoded to a space, and an ISO-8601 value
> never contains a space. %2B and RAW(...) work too.
> * Only the types that Camel options use. LocalDateTime and LocalDate have no
> zone, so a converter for them would guess one.
> Visible change: an expression such as ${headerAs(x, java.time.Instant)} on an
> ISO-8601 string now converts instead of giving null. Upgrade guide note.
> Found while fixing CAMEL-27185 (PR #30730), which added a String ->
> OffsetDateTime converter to ServiceBusTypeConverter only; that one moves to
> core with this ticket.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)