davsclaus opened a new pull request, #28921: URL: https://github.com/apache/camel/pull/28921
Fixes [CAMEL-26151](https://issues.apache.org/jira/browse/CAMEL-26151). ## The exchange id was the LSN, which is not unique **What was wrong:** `PgReplicationSlotConsumer` set the exchange id to `stream.getLastReceiveLSN().asString()`. Several messages share one LSN (for example the `BEGIN` and the first change of a transaction with `test_decoding`), and the value can be `0/0`. So exchange ids repeated, and anything keyed on the exchange id (idempotency, aggregation, tracing, the inflight registry) mixed up exchanges. **What changed:** the exchange keeps the id Camel generates, as with any other consumer. The LSN is in a new header `CamelPgReplicationSlotLsn` (a `String` such as `0/16B3748`), declared in the new `PgReplicationSlotConstants` (`headersClass` of the endpoint). The `@BodyTypes` description, which said "The exchange id is the LSN of the message", now points at the header. **Tests:** new `PgReplicationSlotConsumerTest` uses the fake PostgreSQL server of `PgReplicationSlotConsumerReconnectTest`: - two messages with the same LSN get two distinct exchange ids, and both carry the LSN header; - two messages carry their own LSN in the header. Both failed before the fix (`exchange ids are not unique: [0/16B3748, 0/16B3748]`, and the header was `null`). The fake now records the exchange id and the header, and its LSN keeps growing across flushes (before, it restarted at 1 after each flush). The existing reconnect tests still pass. Module: 9 unit tests and `PgReplicationSlotCamelIT` (PostgreSQL in Docker) pass. **Docs and generated files:** the component doc says where the LSN is and that it is not unique. Upgrade guide entry under `camel-pg-replication-slot` in 4.24. Regenerated the component JSON, the catalog copies of the JSON and the doc, and the Endpoint DSL header builder. **Not changed:** the commit and the status updates still use `getLastReceiveLSN()` as before. _Claude Code on behalf of Claus Ibsen (davsclaus)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
