JacksonDataFormatConfigurator: Ability to set a ObjectMapper on a ObjectValue configuration


#1

given

ObjectValue customerDataValue = Variables.objectValue(customerData)
  .serializationDataFormat(Variables.SerializationDataFormats.JSON)
  .create();

would be great if we could set a callback or a specific instance of a ObjectMapper when creating a ObjectValue instance?

Been looking at the JacksonDataFormatConfigurator, and the issue i see at the moment is the OM that camunda provides has many deeper configurations. And in some cases I want to use a specific OM for De/Serialization. This possible?


#2

As another test of performance, would be interested to know the extra overhead involved if we go from object to Jackson serialize string to SPIN object to storage in Camunda. And then reverse back into the original object.

Assume you have a envelop with a type field you can use Jackson polymorphism to easily convert back and don’t need to store much extras. But the double sterilization seems to start to get expensive.


#3

Hi Stephen,

You can configure the object mapper that Camunda BPM (via Spin) uses as described here: https://docs.camunda.org/manual/7.10/reference/spin/json/05-configuring-json/ and https://github.com/camunda/camunda-bpm-examples/tree/master/spin/dataformat-configuration-global.

Cheers,
Thorben

edit:

This is not possible as you are describing it.


#4

Is there anything special about the Camunda default objectMapper that is required for Camunda? Have people completely replaced the mapper without issues?

Doing a quick review seems to show that there is lots of customizations and configs setup in the default mapper, so trying to understand the impacts of the default mapper is completely swapped out.


#5

Can you please give a pointer to the code that does customization? From my memory, Spin uses pretty much a default ObjectMapper instance and (de-)serialization is pretty robust with respect to custom configuration. I recommend to just try it out and write some tests to ensure that (de-)serialization still works after you have applied your configuration.