cJsonWriter switch to unmarshal() instead of marshal() when using a Custom JSON library?
I'm creating a simple Talend Route using the cJsonWriter component to convert a Map<String, Object> body to a JSON formatted string.
If I use the component with one of the provided JSON Library (like Jackson), my route generates code looking like that : from(...).setBody().marshal().json(org.apache.camel.model.dataformat.JsonLibrary.Jackson, false).
This is perfectly normal since the cJsonWriter component is suppose to serialize with the marshal() method.
What I don’t understand is when I switch the JSON Library to “Custom” on the component the code generated becomes : from(...).setBody().unmarshal().custom(“beanName”). Suddenly the same cJsonWriter component decides that it’s now deserializing (with unmarshal) instead of serializing like it was before. The route execution then fails because the content of the message body is not a JSON formatted String.
As anybody else seen this behavior or could explain why it’s doing that (if it’s not a known issue)?
In the meantime time I'm using a cJavaDSLProcessor to add the .marshal().custom("beanName") to my Route instead using the cJsonWriter component.
Note : To give just a bit of context, I need to use a customize JacksonDataFormat to serialize the java.sql.Timestamp object to String instead of the standard 64bit Integer.