-
Notifications
You must be signed in to change notification settings - Fork 74
Description
In version 2.0 we simply documented the fact that you have to use Jackson 2 ObjectMapper if you want use the custom JSON mapper feature in Spring Pulsar (summary comment).
Implementation details
Ideally, we want to support both Jackson 2 ObjectMapper and Jackson 3 JsonMapper (similar to spring-data-commons).
The trick is that Pulsar proper does not support Jackson 3 (nor is it on the roadmap). I have not dug deep enough to see if we can use JsonMapper (i.e. i'm not sure where the Jackson 2 vs. Jackson 3 membrane resides - so to speak).
Here are the current touch points where we will need operate on:
Messages
Pulsar message custom mapping.
Here is a rough code call chain (i.e. important points to check out):
NOTE: User must customize the DSR to "set the om on dsr"
DefaultSchemaResolver#jsonSchemaForMessageType
if (om set on dsr)
JSONSchemaUtil.schemaForTypeWithObjectMapper(type, om)
If you need a schema instance using a custom om - you must call JSONSchemaUtil yourselfMessage headers
Pulsar message header custom mapping.
Here is a rough code call chain (i.e. important points to check out):
Pulsar(Listener|Reader)AnnotationBeanPostProcessor#postProcessEndpointsBeforeRegistration
PulsarHeaderObjectMapperUtils.customMapper(this.requireNonNullBeanFactory())
.ifPresent((objectMapper) -> this.processedEndpoints
.forEach((endpoint) -> endpoint.setObjectMapper(objectMapper)));
PulsarHeaderObjectMapperUtils#customMapper
looks up OM w/ bean name "pulsarHeaderObjectMapper"
MethodPulsarListenerEndpoint#setObjectMapper
MethodPulsarReaderEndpoint#setObjectMapper
AbstractPulsarMessageToSpringMessageAdapter#setObjectMapper
NOTE: User must set om on the JPHMB JsonPulsarHeaderMapperBuilder#objectMapper