davsclaus opened a new pull request, #28336:
URL: https://github.com/apache/camel/pull/28336

   The audit trail example of the Keycloak consumer page 
(`components/camel-keycloak/src/main/docs/keycloak-consumer.adoc`) sent the 
JSON audit record to `jdbc:dataSource` as the message body. The JDBC component 
runs the body as SQL, so the example could not work.
   
   **Changes** (Java and YAML tabs)
   - The route sets an SQL insert as the body before the JDBC step, and passes 
the audit record in the `CamelJdbcParameters` header as the values of its named 
parameters (`:?timestamp`, ...). A short paragraph above the tabs says how the 
JDBC component takes the SQL and the parameters.
   - Every named parameter gets a value, so an admin event without auth details 
inserts nulls instead of failing on a missing key.
   - YAML: the record is built with the Simple `map` function, instead of a 
JSON text that `marshal` then encoded a second time. The auth details use the 
null-safe form `${body?.authDetails?.userId}`; `${body.authDetails?.userId}` 
fails when an event has no auth details.
   - Java: the timestamp is the epoch millis of the event, as in the JSON and 
the YAML tab, so it binds on any JDBC driver (`setObject` with a 
`java.util.Date` is driver-specific).
   - The catalog copy of the page is updated.
   
   **Tests**
   - Both tabs ran with `camel run` (4.24.0-SNAPSHOT) against an in-memory H2 
database, with a timer sending real Keycloak `AdminEventRepresentation` objects 
instead of the consumer, and a log endpoint instead of Kafka: four rows 
inserted, two of them from events without auth details, no errors.
   - The YAML tab passes `camel validate` (schema, endpoint URIs, Simple).
   
   _Claude Code on behalf of 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]

Reply via email to