oscerd opened a new issue, #1801:
URL: https://github.com/apache/camel-kafka-connector/issues/1801

   ## Description
   
   Three options are matched with a `switch` whose `default` branch does 
nothing, and none of them
   declares a `ConfigDef.ValidString` validator, so a typo is accepted at 
connector submission and only
   shows up later as unrelated behaviour.
   
   In `CamelKafkaConnectMain.Builder.build()`:
   
   1. **`camel.idempotency.expression.type`** (lines 269-279) handles `"body"` 
and `"header"`. Any other
      value (`"headers"`, `"Body"`, ...) leaves 
`camel.kamelet.ckcIdempotent.idempotentExpression`
      unset, so the `ckcIdempotent` template falls back to its 
`templateParameter` default
      `"dummyExpression"`. `simple("dummyExpression")` is a constant, so the 
idempotent consumer treats
      every record after the first as a duplicate and silently drops it.
   2. **`camel.idempotency.repository.type`** (lines 282-291) handles 
`"memory"` and `"kafka"`. Any other
      value leaves `idempotentRepo` null, which is then `bind()`-ed, producing 
a startup failure whose
      message has nothing to do with the actual typo.
   3. **`camel.error.handler`** (lines 239-250) handles `"no"` and `"default"`. 
Any other value keeps a
      plain `DefaultErrorHandlerBuilder` **without** the configured 
`camel.error.handler.max.redeliveries`
      and `camel.error.handler.redelivery.delay`, so the operator's retry 
policy is silently ignored.
   
   ## Expected Behavior
   
   A misspelled value for a behaviour-selecting option is rejected when the 
connector configuration is
   submitted, with a message naming the option and the allowed values.
   
   ## Actual Behavior
   
   The value is accepted and the connector starts with silently different 
behaviour (case 1 and 3) or
   fails at startup with an unrelated error (case 2).
   
   ## Additional Context
   
   Suggested direction:
   
   - Add `ConfigDef.ValidString.in(...)` validators for the three options in
     `CamelSinkConnectorConfig` / `CamelSourceConnectorConfig`.
   - Consider making the `switch` `default` branches throw rather than fall 
through, so the templates do
     not need live fallback defaults such as `"dummyExpression"`.


-- 
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]

Reply via email to