[
https://issues.apache.org/jira/browse/CAMEL-27185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-27185 started by Claus Ibsen.
-------------------------------------------
> camel-azure-servicebus - scheduledEnqueueTime option cannot be set from a URI
> -----------------------------------------------------------------------------
>
> Key: CAMEL-27185
> URL: https://issues.apache.org/jira/browse/CAMEL-27185
> Project: Camel
> Issue Type: Bug
> Components: camel-azure-servicebus
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> h3. Problem
> The producer option {{scheduledEnqueueTime}} is a
> {{java.time.OffsetDateTime}}, and there is no type converter from String to
> {{OffsetDateTime}} (neither in {{ServiceBusTypeConverter}} nor in
> camel-core), so it cannot be set in an endpoint URI or as a property:
> {noformat}
> azure-servicebus:myqueue?producerOperation=scheduleMessages&scheduledEnqueueTime=2026-11-18T23:00:00+01:00&connectionString=...
> {noformat}
> fails at startup with
> {noformat}
> No type converter available to convert from type: java.lang.String to the
> required type: java.time.OffsetDateTime
> {noformat}
> Only a bean reference ({{#bean}}) or the
> {{CamelAzureServiceBusScheduledEnqueueTime}} header (an {{OffsetDateTime}})
> works.
> Also, the option (and the header) is read only by the {{scheduleMessages}}
> operation ({{ServiceBusProducer.scheduleMessages}}). With the default
> {{producerOperation=sendMessages}} it is silently ignored and the message is
> sent at once. The option description ("Sets OffsetDateTime at which the
> message should appear in the Service Bus queue or topic.") does not say so.
> The Kamelet {{azure-servicebus-sink}} therefore offers a delay in seconds
> instead, computed in the template and passed in the header together with the
> operation header.
> h3. Where
> *
> {{components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfiguration.java}}
> - {{scheduledEnqueueTime}} / its javadoc
> *
> {{components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusProducer.java}}
> - {{scheduleMessages}} (the only use)
> *
> {{components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusTypeConverter.java}}
> - no String -> OffsetDateTime converter
> h3. Suggested fix
> * Add a converter {{String -> OffsetDateTime}} ({{OffsetDateTime.parse}},
> ISO-8601) to {{ServiceBusTypeConverter}} (or a general java.time converter in
> camel-core).
> * Document that the option and header are used only with
> {{producerOperation=scheduleMessages}} (or log a WARN when set with
> {{sendMessages}}).
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)