oscerd opened a new issue, #1786:
URL: https://github.com/apache/camel-kafka-connector/issues/1786
## Description
The `core` module contains 5 TODO/XXX comments representing unresolved
technical debt. These should be addressed to improve code quality and resolve
known design concerns.
## Inventory of open items
### 1. `CamelSourceTask.java:214` — Improve sourcePartition/sourceOffset
handling
The source partition and offset are constructed using hardcoded keys
(`"filename"` and `"position"`), which is a placeholder approach:
```java
// TODO: see if there is a better way to use sourcePartition and sourceOffset
Map<String, String> sourcePartition = Collections.singletonMap("filename",
exchange.getFromEndpoint().toString());
Map<String, String> sourceOffset = Collections.singletonMap("position",
exchange.getExchangeId());
```
**Plan:** Investigate using endpoint-specific partition keys (e.g. topic
name, queue name, file path) and meaningful offsets (e.g. message sequence
number, file position) that enable Kafka Connect's offset tracking to correctly
resume after restarts.
### 2. `CamelSourceTask.java:266` — Unsafe cast from SourceRecord to
CamelSourceRecord (KAFKA-12391)
```java
///XXX: this should be a safe cast please see:
https://issues.apache.org/jira/browse/KAFKA-12391
Integer claimCheck = ((CamelSourceRecord)record).getClaimCheck();
```
**Plan:** Check the current status of KAFKA-12391 in Kafka 4.x. If the API
contract now guarantees that `commitRecord` receives the original record type,
remove the XXX comment. If not, add a defensive `instanceof` check with a clear
error message.
### 3. `CamelSourceTask.java:358` — BigDecimal header encoding note
```java
//XXX: kafka connect configured header converter takes care of the encoding,
//default: org.apache.kafka.connect.storage.SimpleHeaderConverter
record.headers().addDecimal(keyCamelHeader, (BigDecimal)value);
```
**Plan:** This is an informational note, not a bug. Verify the behavior is
correct with both `SimpleHeaderConverter` and `JsonConverter`, then either
remove the XXX (if no issue exists) or document the caveat in user-facing docs.
### 4. `CamelKafkaConnectMain.java:226` — Make `dumpRoutes` configurable
```java
//TODO: make it configurable
camelMain.configure().setDumpRoutes(Boolean.TRUE.toString());
```
**Plan:** Add a new configuration property `camel.connector.dumpRoutes`
(default: `true` for backward compatibility) to `CamelConnectorConfig`. Wire it
through the `CamelKafkaConnectMain.Builder` so users can disable route dumping
in production.
### 5. `CamelKafkaConnectMain.java:319` — Rename aggregation strategy
constant
```java
//TODO: change CamelConnectorConfig.CAMEL_CONNECTOR_AGGREGATE_NAME to
ckcAggregationStrategy?
routeTemplate("ckcAggregator")
.templateParameter("aggregationStrategy",
CamelConnectorConfig.CAMEL_CONNECTOR_AGGREGATE_NAME)
```
**Plan:** Rename the template parameter default to
`"ckcAggregationStrategy"` for consistency with the `"ckcAggregator"` route
template naming convention. Update any references in tests and docs.
## Approach
Each item can be addressed independently. Items 1 and 4 are the most
impactful (user-facing behavior improvements). Items 2 and 3 require checking
upstream Kafka status. Item 5 is a straightforward rename.
--
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]