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

   ## Summary
   
   - Fixed the Couchbase consumer to avoid using the shaded Jackson `JsonNode` 
class for view key deserialization, using `String.class` instead which works 
regardless of which Jackson serializer is active
   - Extracted `ClusterEnvironment` creation into a dedicated 
`createClusterEnvironment()` method with documentation explaining why 
`DefaultJsonSerializer` is explicitly configured to prevent the Couchbase SDK 
from auto-detecting non-shaded Jackson on the classpath
   - Added a unit test verifying the `ClusterEnvironment` uses 
`DefaultJsonSerializer` (wrapped in `JsonValueSerializerWrapper`) instead of 
the auto-detected `JacksonJsonSerializer`
   
   ## Details
   
   When Jackson is on the classpath (e.g., via camel-jackson, Spring Boot, or 
Quarkus), the Couchbase SDK auto-detects it and uses `JacksonJsonSerializer` 
backed by the non-shaded Jackson `ObjectMapper`. This causes deserialization 
failures because the consumer code was using `row.keyAs(JsonNode.class)` where 
`JsonNode` is the shaded class 
(`com.couchbase.client.core.deps.com.fasterxml.jackson.databind.JsonNode`), 
which the non-shaded Jackson cannot deserialize into.
   
   The fix addresses this at two levels:
   1. **Consumer level**: Replaced `row.keyAs(JsonNode.class).get().asText()` 
with `row.keyAs(String.class).orElse(null)`, eliminating the dependency on 
shaded Jackson types for key extraction
   2. **Environment level**: Kept the `DefaultJsonSerializer` configuration 
(from CAMEL-22083) but refactored it into a well-documented, testable method
   
   ## Test plan
   
   - [x] Unit tests pass (27 tests, 0 failures)
   - [ ] Integration tests with Couchbase container (require testcontainers)
   - [ ] Manual verification with Jackson on the classpath


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