Hi,
Few questions in my mind.
1.) Is it possible to send Java objects over vert.x event bus?
2.) What is the serialization mechanism used in vert.x ? Java standard serialization ??
private final FSTConfiguration fstConf = FSTConfiguration.createDefaultConfiguration();
@Override
public void handle(final Message<String> message) {
[...]
final ByteArrayOutputStream arrayOut = new ByteArrayOutputStream();
final FSTObjectOutput out = this.fstConf.getObjectOutput(arrayOut);
try {
out.writeObject(someObject, SomeObject.class);
out.flush();
} catch (final IOException e) {
e.printStackTrace();
}
message.reply(out.getBuffer());
try {
arrayOut.close();
} catch (final IOException e) {
e.printStackTrace();
}
}
[...]
new Handler<Message<byte[]>>() {
@Override
public void handle(final Message<byte[]> event) {
final ByteArrayInputStream byteArray = new ByteArrayInputStream(event.body());
try {
final FSTObjectInput in = SomeHandler.this.fstConf.getObjectInput(byteArray);
final T result = ((T) in.readObject());
byteArray.close();
} catch (final IOException | ClassNotFoundException | InterruptedException e) {
e.printStackTrace();
}
}
});
[...]
message.reply(out.getBuffer())
new Handler<Message<byte[]>>() {...}