Hazelcast Jet and Node.JS client serialization issue

I am having Jet 0.6 as a backup and some Node.JS process with hazelcast-nodejs-client 0.8.0 installed. I am trying to push to map an object from Node process that is exactly a reflection of similar one on the Jet side. However I don't understand how to make sure on Jet's side this JS object will be serialized/deserialized respectively. I have a feeling I need to indicate to Jet that this JSON object is meant to be Data POJO and proper serialization/deserialization should be used.

On the node side:

var data = {
    id: someObject.did, // long
    time: someObject.time, // long
};
dataMap.put(data.id, data).then(
    function () {
        console.log("Ok");
    },
    function (error) {
        console.error(error);
    }
);

On Jet's side: public class Data implements Serializable {

private long id;
private long time;

public Data(long id, long time) {
    this.id = id;
    this.time = time;
}

public long getId() {
    return id;
}

public long getTime() {
    return time;
}

UPDATE:

I managed to trace down the call stack to a DefaultSerializer.ts that is apparently responsible for converting JS objects into Data instances to be sent over MapProxy service to the cache:

export class JsonSerializer implements Serializer {
    getId(): number {
        return -130;
    }

    read(input: DataInput): any {
        return JSON.parse(input.readUTF());
    }

    write(output: DataOutput, object: any): void {
        output.writeUTF(JSON.stringify(object));
    }
}

1 answer