davsclaus opened a new pull request, #28917: URL: https://github.com/apache/camel/pull/28917
Fixes [CAMEL-26146](https://issues.apache.org/jira/browse/CAMEL-26146). ### 1. `operation=consume` was listed but does not exist `JooqConfiguration` declared `enums = "NONE,EXECUTE,FETCH,CONSUME"`, but `JooqOperation` only has `EXECUTE`, `FETCH` and `NONE`. The catalog and the docs offered `consume`, and an endpoint with it failed to be created. `CONSUME` is removed from the enums (the consumer is used through `from`, not through the operation). Test: `JooqComponentTest.testOperationEnumsMatchJooqOperation` checks that the enums of the `operation` option match `JooqOperation`. It failed before (`CONSUME,EXECUTE,FETCH,NONE`). ### 2. Operation NONE with no body stored an empty record With a null body, the producer expression created a new instance of the `entityType` and `JooqProducer` stored it with `batchStore`. So a message with no body inserted an empty row, or failed with a database constraint error when a column is `NOT NULL`. It now fails with an `InvalidPayloadException` with the hint `operation NONE needs a record of the entityType in the message body`. ### 3. EXECUTE or FETCH with no body and no `query` option failed with NoSuchMethodException The same code called `getInjector().newInstance(Query.class)` / `newInstance(ResultQuery.class)`. These are interfaces, so it failed with `NoSuchMethodException: org.jooq.Query.<init>()`. It now fails with an `InvalidPayloadException` with the hint `operation EXECUTE needs an org.jooq.Query in the message body, or the query option` (or `org.jooq.ResultQuery` for FETCH). Tests for 2 and 3: new `JooqProducerEmptyBodyTest` sends a null body to each operation and expects an `InvalidPayloadException` with the hint; for NONE it also checks that no row is stored. All three failed before the fix. The test table `book_store` has a `NOT NULL` column, so before the fix the NONE case failed with a constraint error rather than inserting a row; on a table with nullable columns the empty row was inserted. ### Docs and generated files - `jooq-component.adoc`: a note under Operations that a message with no body fails. - Upgrade guide 4.24: a `camel-jooq` entry, since a route that sent an empty body to operation NONE no longer stores a record. - Regenerated `jooq.json` (component and catalog) and the catalog copy of the doc. The endpoint and component DSLs use the `JooqOperation` type and did not change. ### Not changed - A non-null body that cannot be converted still fails with `NoTypeConversionAvailableException`, as before. - The `query` option still takes precedence over the body for EXECUTE and FETCH; NONE ignores it, as before. Module build with `-Psourcecheck`: 25 tests, all pass. _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]
