davsclaus commented on code in PR #26988:
URL: https://github.com/apache/camel/pull/26988#discussion_r4137626555
##########
components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaConfigurationTest.java:
##########
@@ -90,4 +95,16 @@ void sendBufferBytesAppliedToConsumerWithoutSsl() {
Properties props = config.createConsumerProperties();
assertEquals(131072, props.get(ConsumerConfig.SEND_BUFFER_CONFIG));
}
+
+ @Test
+ void byDurationAutoOffsetResetPassesCatalogValidation() throws Exception {
+ try (DefaultCamelContext context = new DefaultCamelContext()) {
+ RuntimeCamelCatalog catalog = new DefaultRuntimeCamelCatalog();
+ catalog.setCamelContext(context);
+ EndpointValidationResult result
+ = catalog.validateProperties("kafka",
Map.of("autoOffsetReset", "by_duration:PT5M"));
Review Comment:
`topic` is a required option, and catalog validation on current `main`
reports it as missing, so the test fails after a rebase:
```suggestion
= catalog.validateProperties("kafka", Map.of("topic",
"test", "autoOffsetReset", "by_duration:PT5M"));
```
##########
components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConfiguration.java:
##########
@@ -986,9 +986,10 @@ public String getAutoOffsetReset() {
}
/**
- * What to do when there is no initial offset in ZooKeeper or if an offset
is out of range: earliest : automatically
- * reset the offset to the earliest offset latest: automatically reset the
offset to the latest offset fail: throw
- * exception to the consumer
+ * What to do when there is no initial offset or if the stored offset is
out of range. Valid values are: earliest
+ * (seek to the earliest available offset), latest (seek to the latest
offset, the default), none (throw an
+ * exception if no previous offset is found), by_duration:<ISO-8601>
(seek to the offset at now minus
+ * duration, e.g. by_duration:PT5M seeks 5 minutes back; requires Kafka
4.0 or later).
Review Comment:
Optional, not blocking: the `<ISO-8601>` escaping ends up verbatim in
the catalog JSON (shown in IDE tooltips and `camel catalog`) and double-escaped
(`&lt;`) in the DSL javadoc. Kafka documents the format as
`by_duration:PnDTnHnMn.nS`, so avoiding angle brackets sidesteps the problem
(followed by a regen):
```suggestion
* exception if no previous offset is found), by_duration:PnDTnHnM (an
ISO-8601 duration; seek to the offset at now
* minus duration, e.g. by_duration:PT5M seeks 5 minutes back; requires
Kafka 4.0 or later).
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]