This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch CAMEL-27185-servicebus in repository https://gitbox.apache.org/repos/asf/camel.git
commit 27257f8d13bed3ba2ece1fe3c6cf89c1c82d004e Author: Claus Ibsen <[email protected]> AuthorDate: Tue Nov 24 16:42:07 2026 +0100 CAMEL-27185, CAMEL-27186: camel-azure-servicebus - scheduledEnqueueTime from a URI, fix option descriptions CAMEL-27185: add a String -> OffsetDateTime converter (ISO-8601) to ServiceBusTypeConverter, so scheduledEnqueueTime can be set in an endpoint URI, as a property or as a string header. A space is read as a +, since the + of a positive offset is decoded to a space in a URI. Document that the option and the header are used only by scheduleMessages. CAMEL-27186: reword the enableDeadLettering description to say what the consumer does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../camel/catalog/components/azure-servicebus.json | 10 ++--- .../catalog/docs/azure-servicebus-component.adoc | 10 +++++ .../servicebus/ServiceBusTypeConverterLoader.java | 8 ++++ .../azure/servicebus/azure-servicebus.json | 10 ++--- .../src/main/docs/azure-servicebus-component.adoc | 10 +++++ .../azure/servicebus/ServiceBusConfiguration.java | 10 +++-- .../azure/servicebus/ServiceBusConstants.java | 3 +- .../azure/servicebus/ServiceBusTypeConverter.java | 17 ++++++++ .../azure/servicebus/ServiceBusEndpointTest.java | 31 +++++++++++++ .../servicebus/ServiceBusTypeConverterTest.java | 51 ++++++++++++++++++++++ .../AzureServicebusComponentBuilderFactory.java | 13 ++++-- .../dsl/ServiceBusEndpointBuilderFactory.java | 33 ++++++++++---- 12 files changed, 180 insertions(+), 26 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json index 1c868480c984..f460375aa3b8 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-servicebus.json @@ -32,7 +32,7 @@ "proxyOptions": { "index": 5, "kind": "property", "displayName": "Proxy Options", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "com.azure.core.amqp.ProxyOptions", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the proxy configuration to use for ServiceBusSenderClient. When a proxy [...] "serviceBusType": { "index": 6, "kind": "property", "displayName": "Service Bus Type", "group": "common", "label": "common", "required": true, "type": "enum", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusType", "enum": [ "queue", "topic" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "queue", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "descripti [...] "bridgeErrorHandler": { "index": 7, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the like [...] - "enableDeadLettering": { "index": 8, "kind": "property", "displayName": "Enable Dead Lettering", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Enable application level deadlettering to the subscription [...] + "enableDeadLettering": { "index": 8, "kind": "property", "displayName": "Enable Dead Lettering", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Dead-letters the message of a failed exchange instead of ab [...] "maxAutoLockRenewDuration": { "index": 9, "kind": "property", "displayName": "Max Auto Lock Renew Duration", "group": "consumer", "label": "consumer", "required": false, "type": "duration", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "300000", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the amount of time (millis) to continue a [...] "maxConcurrentCalls": { "index": 10, "kind": "property", "displayName": "Max Concurrent Calls", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets maximum number of concurrent calls" }, "maxConcurrentSessions": { "index": 11, "kind": "property", "displayName": "Max Concurrent Sessions", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the maximum number of concurrent sessions to process at a [...] @@ -45,7 +45,7 @@ "binary": { "index": 18, "kind": "property", "displayName": "Binary", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Set binary mode. If true, message body will be sent as byte[]. By default, it is false." }, "lazyStartProducer": { "index": 19, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fai [...] "producerOperation": { "index": 20, "kind": "property", "displayName": "Producer Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusProducerOperationDefinition", "enum": [ "sendMessages", "scheduleMessages" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "sendMessages", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfig [...] - "scheduledEnqueueTime": { "index": 21, "kind": "property", "displayName": "Scheduled Enqueue Time", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.time.OffsetDateTime", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets OffsetDateTime at which the message should appear in the S [...] + "scheduledEnqueueTime": { "index": 21, "kind": "property", "displayName": "Scheduled Enqueue Time", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.time.OffsetDateTime", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets OffsetDateTime at which the message should appear in the S [...] "senderClient": { "index": 22, "kind": "property", "displayName": "Sender Client", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusSenderClient", "deprecated": false, "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets senderClient to be used in the producer." }, "serviceBusTransactionContext": { "index": 23, "kind": "property", "displayName": "Service Bus Transaction Context", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusTransactionContext", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Represents [...] "sessionId": { "index": 24, "kind": "property", "displayName": "Session Id", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Session ID for session-enabled queues or topics." }, @@ -77,7 +77,7 @@ "CamelAzureServiceBusSubject": { "index": 18, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "Gets the subject for the message.", "constantName": "org.apache.camel.component.azure.servicebus.ServiceBusConstants#SUBJECT" }, "CamelAzureServiceBusTimeToLive": { "index": 19, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "java.time.Duration", "deprecated": false, "autowired": false, "secret": false, "description": "Gets the duration before this message expires.", "constantName": "org.apache.camel.component.azure.servicebus.ServiceBusConstants#TIME_TO_LIVE" }, "CamelAzureServiceBusTo": { "index": 20, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "Gets the to address.", "constantName": "org.apache.camel.component.azure.servicebus.ServiceBusConstants#TO" }, - "CamelAzureServiceBusScheduledEnqueueTime": { "index": 21, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "java.time.OffsetDateTime", "deprecated": false, "autowired": false, "secret": false, "description": "(producer)Overrides the OffsetDateTime at which the message should appear in the Service Bus queue or topic. (consumer) Gets the scheduled enqueue time of this message.", "constantName": "org.apache.camel.component.azure.servic [...] + "CamelAzureServiceBusScheduledEnqueueTime": { "index": 21, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "java.time.OffsetDateTime", "deprecated": false, "autowired": false, "secret": false, "description": "(producer) Overrides the OffsetDateTime at which the message should appear in the Service Bus queue or topic. Used only by the scheduleMessages operation. (consumer) Gets the scheduled enqueue time of this message.", "constantN [...] "CamelAzureServiceBusServiceBusTransactionContext": { "index": 22, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "com.azure.messaging.servicebus.ServiceBusTransactionContext", "deprecated": false, "autowired": false, "secret": false, "description": "Overrides the transaction in service. This object just contains transaction id.", "constantName": "org.apache.camel.component.azure.servicebus.ServiceBusConstants#SERVICE_BUS [...] "CamelAzureServiceBusProducerOperation": { "index": 23, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusProducerOperationDefinition", "enum": [ "sendMessages", "scheduleMessages" ], "deprecated": false, "autowired": false, "secret": false, "description": "Overrides the desired operation to be used in the producer.", "constantName": "org.apache.camel.component.azure.ser [...] "CamelAzureServiceBusCorrelationId": { "index": 24, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "Gets or Sets a correlation identifier.", "constantName": "org.apache.camel.component.azure.servicebus.ServiceBusConstants#CORRELATION_ID" } @@ -95,7 +95,7 @@ "headerFilterStrategy": { "index": 4, "kind": "parameter", "displayName": "Header Filter Strategy", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "To use a custom HeaderFilterStrategy to filter Ser [...] "proxyOptions": { "index": 5, "kind": "parameter", "displayName": "Proxy Options", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "com.azure.core.amqp.ProxyOptions", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the proxy configuration to use for ServiceBusSenderClient. When a proxy [...] "serviceBusType": { "index": 6, "kind": "parameter", "displayName": "Service Bus Type", "group": "common", "label": "common", "required": true, "type": "enum", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusType", "enum": [ "queue", "topic" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "queue", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "descript [...] - "enableDeadLettering": { "index": 7, "kind": "parameter", "displayName": "Enable Dead Lettering", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Enable application level deadlettering to the subscription [...] + "enableDeadLettering": { "index": 7, "kind": "parameter", "displayName": "Enable Dead Lettering", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Dead-letters the message of a failed exchange instead of a [...] "maxAutoLockRenewDuration": { "index": 8, "kind": "parameter", "displayName": "Max Auto Lock Renew Duration", "group": "consumer", "label": "consumer", "required": false, "type": "duration", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "300000", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the amount of time (millis) to continue [...] "maxConcurrentCalls": { "index": 9, "kind": "parameter", "displayName": "Max Concurrent Calls", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets maximum number of concurrent calls" }, "maxConcurrentSessions": { "index": 10, "kind": "parameter", "displayName": "Max Concurrent Sessions", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the maximum number of concurrent sessions to process at [...] @@ -110,7 +110,7 @@ "exchangePattern": { "index": 19, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, "binary": { "index": 20, "kind": "parameter", "displayName": "Binary", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Set binary mode. If true, message body will be sent as byte[]. By default, it is false." }, "producerOperation": { "index": 21, "kind": "parameter", "displayName": "Producer Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusProducerOperationDefinition", "enum": [ "sendMessages", "scheduleMessages" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "sendMessages", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfi [...] - "scheduledEnqueueTime": { "index": 22, "kind": "parameter", "displayName": "Scheduled Enqueue Time", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.time.OffsetDateTime", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets OffsetDateTime at which the message should appear in the [...] + "scheduledEnqueueTime": { "index": 22, "kind": "parameter", "displayName": "Scheduled Enqueue Time", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.time.OffsetDateTime", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets OffsetDateTime at which the message should appear in the [...] "senderClient": { "index": 23, "kind": "parameter", "displayName": "Sender Client", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusSenderClient", "deprecated": false, "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets senderClient to be used in the producer." }, "serviceBusTransactionContext": { "index": 24, "kind": "parameter", "displayName": "Service Bus Transaction Context", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusTransactionContext", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Represents [...] "sessionId": { "index": 25, "kind": "parameter", "displayName": "Session Id", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Session ID for session-enabled queues or topics." }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/azure-servicebus-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/azure-servicebus-component.adoc index 01b0db60b6dd..3daae73b5374 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/azure-servicebus-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/azure-servicebus-component.adoc @@ -159,6 +159,16 @@ from("direct:start") .to("mock:result"); ---- +The time can also be set with the `scheduledEnqueueTime` option, or as a string in the header, as an ISO-8601 date-time +with an offset, such as `2026-11-18T22:00:00Z` or `2026-11-18T23:00:00+01:00`. The option and the header are used only by +`scheduleMessages`: `sendMessages` sends the message at once. + +[source,java] +---- +from("direct:start") + .to("azure-servicebus:test?connectionString=test&producerOperation=scheduleMessages&scheduledEnqueueTime=2026-11-18T23:00:00+01:00"); +---- + - `receiveMessages` [tabs] diff --git a/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusTypeConverterLoader.java b/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusTypeConverterLoader.java index f2414482fac6..83f151d0796f 100644 --- a/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusTypeConverterLoader.java +++ b/components/camel-azure/camel-azure-servicebus/src/generated/java/org/apache/camel/component/azure/servicebus/ServiceBusTypeConverterLoader.java @@ -76,6 +76,14 @@ public final class ServiceBusTypeConverterLoader implements TypeConverterLoader, } return answer; }); + addTypeConverter(registry, java.time.OffsetDateTime.class, java.lang.String.class, true, + (type, exchange, value) -> { + Object answer = org.apache.camel.component.azure.servicebus.ServiceBusTypeConverter.toOffsetDateTime((java.lang.String) value); + if (true && answer == null) { + answer = Void.class; + } + return answer; + }); } private static void addTypeConverter(TypeConverterRegistry registry, Class<?> toType, Class<?> fromType, boolean allowNull, SimpleTypeConverter.ConversionMethod method) { diff --git a/components/camel-azure/camel-azure-servicebus/src/generated/resources/META-INF/org/apache/camel/component/azure/servicebus/azure-servicebus.json b/components/camel-azure/camel-azure-servicebus/src/generated/resources/META-INF/org/apache/camel/component/azure/servicebus/azure-servicebus.json index 1c868480c984..f460375aa3b8 100644 --- a/components/camel-azure/camel-azure-servicebus/src/generated/resources/META-INF/org/apache/camel/component/azure/servicebus/azure-servicebus.json +++ b/components/camel-azure/camel-azure-servicebus/src/generated/resources/META-INF/org/apache/camel/component/azure/servicebus/azure-servicebus.json @@ -32,7 +32,7 @@ "proxyOptions": { "index": 5, "kind": "property", "displayName": "Proxy Options", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "com.azure.core.amqp.ProxyOptions", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the proxy configuration to use for ServiceBusSenderClient. When a proxy [...] "serviceBusType": { "index": 6, "kind": "property", "displayName": "Service Bus Type", "group": "common", "label": "common", "required": true, "type": "enum", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusType", "enum": [ "queue", "topic" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "queue", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "descripti [...] "bridgeErrorHandler": { "index": 7, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the like [...] - "enableDeadLettering": { "index": 8, "kind": "property", "displayName": "Enable Dead Lettering", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Enable application level deadlettering to the subscription [...] + "enableDeadLettering": { "index": 8, "kind": "property", "displayName": "Enable Dead Lettering", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Dead-letters the message of a failed exchange instead of ab [...] "maxAutoLockRenewDuration": { "index": 9, "kind": "property", "displayName": "Max Auto Lock Renew Duration", "group": "consumer", "label": "consumer", "required": false, "type": "duration", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "300000", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the amount of time (millis) to continue a [...] "maxConcurrentCalls": { "index": 10, "kind": "property", "displayName": "Max Concurrent Calls", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets maximum number of concurrent calls" }, "maxConcurrentSessions": { "index": 11, "kind": "property", "displayName": "Max Concurrent Sessions", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the maximum number of concurrent sessions to process at a [...] @@ -45,7 +45,7 @@ "binary": { "index": 18, "kind": "property", "displayName": "Binary", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Set binary mode. If true, message body will be sent as byte[]. By default, it is false." }, "lazyStartProducer": { "index": 19, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fai [...] "producerOperation": { "index": 20, "kind": "property", "displayName": "Producer Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusProducerOperationDefinition", "enum": [ "sendMessages", "scheduleMessages" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "sendMessages", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfig [...] - "scheduledEnqueueTime": { "index": 21, "kind": "property", "displayName": "Scheduled Enqueue Time", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.time.OffsetDateTime", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets OffsetDateTime at which the message should appear in the S [...] + "scheduledEnqueueTime": { "index": 21, "kind": "property", "displayName": "Scheduled Enqueue Time", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.time.OffsetDateTime", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets OffsetDateTime at which the message should appear in the S [...] "senderClient": { "index": 22, "kind": "property", "displayName": "Sender Client", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusSenderClient", "deprecated": false, "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets senderClient to be used in the producer." }, "serviceBusTransactionContext": { "index": 23, "kind": "property", "displayName": "Service Bus Transaction Context", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusTransactionContext", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Represents [...] "sessionId": { "index": 24, "kind": "property", "displayName": "Session Id", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Session ID for session-enabled queues or topics." }, @@ -77,7 +77,7 @@ "CamelAzureServiceBusSubject": { "index": 18, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "Gets the subject for the message.", "constantName": "org.apache.camel.component.azure.servicebus.ServiceBusConstants#SUBJECT" }, "CamelAzureServiceBusTimeToLive": { "index": 19, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "java.time.Duration", "deprecated": false, "autowired": false, "secret": false, "description": "Gets the duration before this message expires.", "constantName": "org.apache.camel.component.azure.servicebus.ServiceBusConstants#TIME_TO_LIVE" }, "CamelAzureServiceBusTo": { "index": 20, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "Gets the to address.", "constantName": "org.apache.camel.component.azure.servicebus.ServiceBusConstants#TO" }, - "CamelAzureServiceBusScheduledEnqueueTime": { "index": 21, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "java.time.OffsetDateTime", "deprecated": false, "autowired": false, "secret": false, "description": "(producer)Overrides the OffsetDateTime at which the message should appear in the Service Bus queue or topic. (consumer) Gets the scheduled enqueue time of this message.", "constantName": "org.apache.camel.component.azure.servic [...] + "CamelAzureServiceBusScheduledEnqueueTime": { "index": 21, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "java.time.OffsetDateTime", "deprecated": false, "autowired": false, "secret": false, "description": "(producer) Overrides the OffsetDateTime at which the message should appear in the Service Bus queue or topic. Used only by the scheduleMessages operation. (consumer) Gets the scheduled enqueue time of this message.", "constantN [...] "CamelAzureServiceBusServiceBusTransactionContext": { "index": 22, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "com.azure.messaging.servicebus.ServiceBusTransactionContext", "deprecated": false, "autowired": false, "secret": false, "description": "Overrides the transaction in service. This object just contains transaction id.", "constantName": "org.apache.camel.component.azure.servicebus.ServiceBusConstants#SERVICE_BUS [...] "CamelAzureServiceBusProducerOperation": { "index": 23, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusProducerOperationDefinition", "enum": [ "sendMessages", "scheduleMessages" ], "deprecated": false, "autowired": false, "secret": false, "description": "Overrides the desired operation to be used in the producer.", "constantName": "org.apache.camel.component.azure.ser [...] "CamelAzureServiceBusCorrelationId": { "index": 24, "kind": "header", "displayName": "", "group": "common", "label": "common", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "Gets or Sets a correlation identifier.", "constantName": "org.apache.camel.component.azure.servicebus.ServiceBusConstants#CORRELATION_ID" } @@ -95,7 +95,7 @@ "headerFilterStrategy": { "index": 4, "kind": "parameter", "displayName": "Header Filter Strategy", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "To use a custom HeaderFilterStrategy to filter Ser [...] "proxyOptions": { "index": 5, "kind": "parameter", "displayName": "Proxy Options", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "com.azure.core.amqp.ProxyOptions", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the proxy configuration to use for ServiceBusSenderClient. When a proxy [...] "serviceBusType": { "index": 6, "kind": "parameter", "displayName": "Service Bus Type", "group": "common", "label": "common", "required": true, "type": "enum", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusType", "enum": [ "queue", "topic" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "queue", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "descript [...] - "enableDeadLettering": { "index": 7, "kind": "parameter", "displayName": "Enable Dead Lettering", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Enable application level deadlettering to the subscription [...] + "enableDeadLettering": { "index": 7, "kind": "parameter", "displayName": "Enable Dead Lettering", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Dead-letters the message of a failed exchange instead of a [...] "maxAutoLockRenewDuration": { "index": 8, "kind": "parameter", "displayName": "Max Auto Lock Renew Duration", "group": "consumer", "label": "consumer", "required": false, "type": "duration", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "300000", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the amount of time (millis) to continue [...] "maxConcurrentCalls": { "index": 9, "kind": "parameter", "displayName": "Max Concurrent Calls", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets maximum number of concurrent calls" }, "maxConcurrentSessions": { "index": 10, "kind": "parameter", "displayName": "Max Concurrent Sessions", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets the maximum number of concurrent sessions to process at [...] @@ -110,7 +110,7 @@ "exchangePattern": { "index": 19, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, "binary": { "index": 20, "kind": "parameter", "displayName": "Binary", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Set binary mode. If true, message body will be sent as byte[]. By default, it is false." }, "producerOperation": { "index": 21, "kind": "parameter", "displayName": "Producer Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.azure.servicebus.ServiceBusProducerOperationDefinition", "enum": [ "sendMessages", "scheduleMessages" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "sendMessages", "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfi [...] - "scheduledEnqueueTime": { "index": 22, "kind": "parameter", "displayName": "Scheduled Enqueue Time", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.time.OffsetDateTime", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets OffsetDateTime at which the message should appear in the [...] + "scheduledEnqueueTime": { "index": 22, "kind": "parameter", "displayName": "Scheduled Enqueue Time", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.time.OffsetDateTime", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets OffsetDateTime at which the message should appear in the [...] "senderClient": { "index": 23, "kind": "parameter", "displayName": "Sender Client", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusSenderClient", "deprecated": false, "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Sets senderClient to be used in the producer." }, "serviceBusTransactionContext": { "index": 24, "kind": "parameter", "displayName": "Service Bus Transaction Context", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.azure.messaging.servicebus.ServiceBusTransactionContext", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Represents [...] "sessionId": { "index": 25, "kind": "parameter", "displayName": "Session Id", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.servicebus.ServiceBusConfiguration", "configurationField": "configuration", "description": "Session ID for session-enabled queues or topics." }, diff --git a/components/camel-azure/camel-azure-servicebus/src/main/docs/azure-servicebus-component.adoc b/components/camel-azure/camel-azure-servicebus/src/main/docs/azure-servicebus-component.adoc index 01b0db60b6dd..3daae73b5374 100644 --- a/components/camel-azure/camel-azure-servicebus/src/main/docs/azure-servicebus-component.adoc +++ b/components/camel-azure/camel-azure-servicebus/src/main/docs/azure-servicebus-component.adoc @@ -159,6 +159,16 @@ from("direct:start") .to("mock:result"); ---- +The time can also be set with the `scheduledEnqueueTime` option, or as a string in the header, as an ISO-8601 date-time +with an offset, such as `2026-11-18T22:00:00Z` or `2026-11-18T23:00:00+01:00`. The option and the header are used only by +`scheduleMessages`: `sendMessages` sends the message at once. + +[source,java] +---- +from("direct:start") + .to("azure-servicebus:test?connectionString=test&producerOperation=scheduleMessages&scheduledEnqueueTime=2026-11-18T23:00:00+01:00"); +---- + - `receiveMessages` [tabs] diff --git a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfiguration.java b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfiguration.java index f2234cc667ec..7ec8d4a457b7 100644 --- a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfiguration.java +++ b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfiguration.java @@ -251,8 +251,10 @@ public class ServiceBusConfiguration implements Cloneable, HeaderFilterStrategyA } /** - * Enable application level deadlettering to the subscription deadletter subqueue if deadletter related headers are - * set. + * Dead-letters the message of a failed exchange instead of abandoning it, with the exception as the dead-letter + * reason and its stack trace as the error description. The message goes to the dead-letter queue of the queue or + * subscription it was received from. Applies only in PEEK_LOCK receive mode, and not when reading a sub-queue + * (subQueue), where the message is abandoned. */ public boolean isEnableDeadLettering() { return enableDeadLettering; @@ -379,7 +381,9 @@ public class ServiceBusConfiguration implements Cloneable, HeaderFilterStrategyA } /** - * Sets OffsetDateTime at which the message should appear in the Service Bus queue or topic. + * Sets OffsetDateTime at which the message should appear in the Service Bus queue or topic. Used only by the + * scheduleMessages producer operation; sendMessages sends the message at once. In an endpoint URI or a property use + * an ISO-8601 date-time with an offset, such as 2026-11-18T22:00:00Z or 2026-11-18T23:00:00+01:00. */ public OffsetDateTime getScheduledEnqueueTime() { return scheduledEnqueueTime; diff --git a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConstants.java b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConstants.java index b79014fba28f..11b520b5baa5 100644 --- a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConstants.java +++ b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConstants.java @@ -82,7 +82,8 @@ public final class ServiceBusConstants { public static final String TO = HEADER_PREFIX + "To"; // headers set by consumer and evaluated by producer - @Metadata(description = "(producer)Overrides the OffsetDateTime at which the message should appear in the Service Bus queue or topic. " + @Metadata(description = "(producer) Overrides the OffsetDateTime at which the message should appear in the Service Bus queue or topic. " + + "Used only by the scheduleMessages operation. " + "(consumer) Gets the scheduled enqueue time of this message.", javaType = "java.time.OffsetDateTime") diff --git a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusTypeConverter.java b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusTypeConverter.java index 131ab6773507..5c6ea8bf7b1b 100644 --- a/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusTypeConverter.java +++ b/components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusTypeConverter.java @@ -17,6 +17,7 @@ package org.apache.camel.component.azure.servicebus; import java.io.InputStream; +import java.time.OffsetDateTime; import com.azure.core.util.BinaryData; import org.apache.camel.Converter; @@ -53,4 +54,20 @@ public final class ServiceBusTypeConverter { } return null; } + + /** + * Converts an ISO-8601 date-time with an offset, such as {@code 2026-11-18T23:00:00+01:00} or + * {@code 2026-11-18T22:00:00Z}, so that the {@code scheduledEnqueueTime} option can be set in an endpoint URI or as + * a property. + * <p/> + * An ISO-8601 date-time never contains a space, so a space is read as a {@code +}: in an endpoint URI the {@code +} + * of a positive offset is decoded to a space, unless the value is written as {@code %2B} or in {@code RAW(...)}. + */ + @Converter(allowNull = true) + public static OffsetDateTime toOffsetDateTime(final String value) { + if (ObjectHelper.isNotEmpty(value)) { + return OffsetDateTime.parse(value.trim().replace(' ', '+')); + } + return null; + } } diff --git a/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointTest.java b/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointTest.java index c061277f5b38..9b2f5abf7bc1 100644 --- a/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointTest.java +++ b/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/ServiceBusEndpointTest.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.azure.servicebus; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; import java.util.HashMap; import java.util.Map; @@ -238,4 +240,33 @@ class ServiceBusEndpointTest extends CamelTestSupport { assertNotNull(senderClient); senderClient.close(); } + + @Test + void testScheduledEnqueueTimeInUri() { + final OffsetDateTime expected = OffsetDateTime.of(2026, 11, 18, 23, 0, 0, 0, ZoneOffset.ofHours(1)); + + // a plain + in the URI is decoded to a space, which the converter reads as a + + ServiceBusEndpoint endpoint = context.getEndpoint( + "azure-servicebus:plusQueue?producerOperation=scheduleMessages&scheduledEnqueueTime=2026-11-18T23:00:00+01:00" + + "&connectionString=testString", + ServiceBusEndpoint.class); + assertEquals(ServiceBusProducerOperationDefinition.scheduleMessages, + endpoint.getConfiguration().getProducerOperation()); + assertEquals(expected, endpoint.getConfiguration().getScheduledEnqueueTime()); + + endpoint = context.getEndpoint( + "azure-servicebus:encodedQueue?scheduledEnqueueTime=2026-11-18T23:00:00%2B01:00&connectionString=testString", + ServiceBusEndpoint.class); + assertEquals(expected, endpoint.getConfiguration().getScheduledEnqueueTime()); + + endpoint = context.getEndpoint( + "azure-servicebus:rawQueue?scheduledEnqueueTime=RAW(2026-11-18T23:00:00+01:00)&connectionString=testString", + ServiceBusEndpoint.class); + assertEquals(expected, endpoint.getConfiguration().getScheduledEnqueueTime()); + + endpoint = context.getEndpoint( + "azure-servicebus:utcQueue?scheduledEnqueueTime=2026-11-18T22:00:00Z&connectionString=testString", + ServiceBusEndpoint.class); + assertEquals(expected.toInstant(), endpoint.getConfiguration().getScheduledEnqueueTime().toInstant()); + } } diff --git a/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/ServiceBusTypeConverterTest.java b/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/ServiceBusTypeConverterTest.java index 035438946034..63dfb69d6b4f 100644 --- a/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/ServiceBusTypeConverterTest.java +++ b/components/camel-azure/camel-azure-servicebus/src/test/java/org/apache/camel/component/azure/servicebus/ServiceBusTypeConverterTest.java @@ -18,12 +18,17 @@ package org.apache.camel.component.azure.servicebus; import java.io.InputStream; import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; import com.azure.core.util.BinaryData; +import org.apache.camel.Exchange; +import org.apache.camel.TypeConversionException; import org.apache.camel.test.junit6.CamelTestSupport; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; class ServiceBusTypeConverterTest extends CamelTestSupport { @@ -50,4 +55,50 @@ class ServiceBusTypeConverterTest extends CamelTestSupport { assertThat(is.readAllBytes()).isEqualTo("Hello Camel".getBytes(StandardCharsets.UTF_8)); } } + + @Test + void testStringToOffsetDateTime() throws Exception { + OffsetDateTime result + = context.getTypeConverter().mandatoryConvertTo(OffsetDateTime.class, "2026-11-18T23:00:00+01:00"); + + assertThat(result).isEqualTo(OffsetDateTime.of(2026, 11, 18, 23, 0, 0, 0, ZoneOffset.ofHours(1))); + } + + @Test + void testStringToOffsetDateTimeUtc() throws Exception { + OffsetDateTime result = context.getTypeConverter().mandatoryConvertTo(OffsetDateTime.class, "2026-11-18T22:00:00Z"); + + assertThat(result).isEqualTo(OffsetDateTime.of(2026, 11, 18, 22, 0, 0, 0, ZoneOffset.UTC)); + } + + @Test + void testStringToOffsetDateTimeDecodedPlus() throws Exception { + // the + of a positive offset, decoded to a space in an endpoint URI + OffsetDateTime result + = context.getTypeConverter().mandatoryConvertTo(OffsetDateTime.class, "2026-11-18T23:00:00 01:00"); + + assertThat(result).isEqualTo(OffsetDateTime.of(2026, 11, 18, 23, 0, 0, 0, ZoneOffset.ofHours(1))); + } + + @Test + void testEmptyStringToOffsetDateTime() { + assertThat(context.getTypeConverter().convertTo(OffsetDateTime.class, "")).isNull(); + } + + @Test + void testInvalidStringToOffsetDateTime() { + assertThatThrownBy(() -> context.getTypeConverter().mandatoryConvertTo(OffsetDateTime.class, "tomorrow")) + .isInstanceOf(TypeConversionException.class); + } + + @Test + void testScheduledEnqueueTimeHeaderAsString() { + Exchange exchange = createExchangeWithBody("Hello Camel"); + exchange.getIn().setHeader(ServiceBusConstants.SCHEDULED_ENQUEUE_TIME, "2026-11-18T23:00:00+01:00"); + + OffsetDateTime result + = new ServiceBusConfigurationOptionsProxy(new ServiceBusConfiguration()).getScheduledEnqueueTime(exchange); + + assertThat(result).isEqualTo(OffsetDateTime.of(2026, 11, 18, 23, 0, 0, 0, ZoneOffset.ofHours(1))); + } } diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureServicebusComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureServicebusComponentBuilderFactory.java index 088f8fe93af7..dbc9a59ab3af 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureServicebusComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureServicebusComponentBuilderFactory.java @@ -205,8 +205,12 @@ public interface AzureServicebusComponentBuilderFactory { /** - * Enable application level deadlettering to the subscription deadletter - * subqueue if deadletter related headers are set. + * Dead-letters the message of a failed exchange instead of abandoning + * it, with the exception as the dead-letter reason and its stack trace + * as the error description. The message goes to the dead-letter queue + * of the queue or subscription it was received from. Applies only in + * PEEK_LOCK receive mode, and not when reading a sub-queue (subQueue), + * where the message is abandoned. * * The option is a: <code>boolean</code> type. * @@ -445,7 +449,10 @@ public interface AzureServicebusComponentBuilderFactory { /** * Sets OffsetDateTime at which the message should appear in the Service - * Bus queue or topic. + * Bus queue or topic. Used only by the scheduleMessages producer + * operation; sendMessages sends the message at once. In an endpoint URI + * or a property use an ISO-8601 date-time with an offset, such as + * 2026-11-18T22:00:00Z or 2026-11-18T23:00:00+01:00. * * The option is a: <code>java.time.OffsetDateTime</code> * type. diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ServiceBusEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ServiceBusEndpointBuilderFactory.java index 31a011ba05cc..b1d1eef60c64 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ServiceBusEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ServiceBusEndpointBuilderFactory.java @@ -244,8 +244,12 @@ public interface ServiceBusEndpointBuilderFactory { return this; } /** - * Enable application level deadlettering to the subscription deadletter - * subqueue if deadletter related headers are set. + * Dead-letters the message of a failed exchange instead of abandoning + * it, with the exception as the dead-letter reason and its stack trace + * as the error description. The message goes to the dead-letter queue + * of the queue or subscription it was received from. Applies only in + * PEEK_LOCK receive mode, and not when reading a sub-queue (subQueue), + * where the message is abandoned. * * The option is a: <code>boolean</code> type. * @@ -260,8 +264,12 @@ public interface ServiceBusEndpointBuilderFactory { return this; } /** - * Enable application level deadlettering to the subscription deadletter - * subqueue if deadletter related headers are set. + * Dead-letters the message of a failed exchange instead of abandoning + * it, with the exception as the dead-letter reason and its stack trace + * as the error description. The message goes to the dead-letter queue + * of the queue or subscription it was received from. Applies only in + * PEEK_LOCK receive mode, and not when reading a sub-queue (subQueue), + * where the message is abandoned. * * The option will be converted to a <code>boolean</code> type. * @@ -1057,7 +1065,10 @@ public interface ServiceBusEndpointBuilderFactory { } /** * Sets OffsetDateTime at which the message should appear in the Service - * Bus queue or topic. + * Bus queue or topic. Used only by the scheduleMessages producer + * operation; sendMessages sends the message at once. In an endpoint URI + * or a property use an ISO-8601 date-time with an offset, such as + * 2026-11-18T22:00:00Z or 2026-11-18T23:00:00+01:00. * * The option is a: <code>java.time.OffsetDateTime</code> type. * @@ -1072,7 +1083,10 @@ public interface ServiceBusEndpointBuilderFactory { } /** * Sets OffsetDateTime at which the message should appear in the Service - * Bus queue or topic. + * Bus queue or topic. Used only by the scheduleMessages producer + * operation; sendMessages sends the message at once. In an endpoint URI + * or a property use an ISO-8601 date-time with an offset, such as + * 2026-11-18T22:00:00Z or 2026-11-18T23:00:00+01:00. * * The option will be converted to a * <code>java.time.OffsetDateTime</code> type. @@ -1979,9 +1993,10 @@ public interface ServiceBusEndpointBuilderFactory { return "CamelAzureServiceBusTo"; } /** - * (producer)Overrides the OffsetDateTime at which the message should - * appear in the Service Bus queue or topic. (consumer) Gets the - * scheduled enqueue time of this message. + * (producer) Overrides the OffsetDateTime at which the message should + * appear in the Service Bus queue or topic. Used only by the + * scheduleMessages operation. (consumer) Gets the scheduled enqueue + * time of this message. * * The option is a: {@code java.time.OffsetDateTime} type. *
