0

I am using msgpack integrated with Axon framework. So on the axon event handler i get object's on runtime which can be of any type.As the object type is unknown, i want to use generic serialization/deserialiation. The serialization is done properly but the issue arises when i deserialize the byte Stream. ex:

public <S, T> T deserialize(SerializedObject<S> serializedObject) {
    byte[] serializedBytes= (byte[]) serializedObject.getData();
    Object bytes = null;
    try {
        bytes=objectMapper.readValue(serializedBytes,Object.class);
        System.out.println("After deserialization : "+bytes);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return (T) bytes;
}

where serializedObject has custom method getData() which contains the serialized bytes. Here i read the value & give representation as Object.class I always get a LinkedHashMap in return value for target. Is there any standard way to perform GENERIC serialization / deserialization for any object type using msgpack.

Anand Kadhi
  • 1,790
  • 4
  • 27
  • 40

1 Answers1

0

Without type information it won't be possible to deserialize the object at runtime using msgpack see here

Anand Kadhi
  • 1,790
  • 4
  • 27
  • 40