Reputation: 497
My case is:
I understand the scope of the vert.x event bus is much broader than my use case.
I had in mind a behaviour similar to akka: when you go distributed you have to provide serialization for your messages, if you stay local references get passed.
Is there anything that would allow me to do that in Vert.x?
Upvotes: 12
Views: 2321
Reputation: 17731
Vert.x already has such an optimization. When sending to the same JVM, objects won't get serialized or deserialized.
You can see the actual code here: https://github.com/eclipse/vert.x/blob/master/src/main/java/io/vertx/core/eventbus/impl/EventBusImpl.java#L372
When you implement your MessageCodec
, you actually have two methods: decodeFromWire()
and transform()
. You can implement only transform with the most naive approach:
@Override
public Object transform(Object o) {
return o;
}
Upvotes: 13