I have a verticle that creates an event bus consumer as follows:
public void start() {
vertx.eventBus().consumer(ADDRESS_REQUEST, this::handleRequestMessage);
}
private void handleRequestMessage(Message<VWApiConversation> msg) {
VWApiConversation conversation = msg.body();
}
But when sending a message to this address :
vertx.eventBus().send(VehicleStateCoordinatorVerticle.ADDRESS_REQUEST, conversation, deliveryOptions, res -> {
...
I get the error :
java.lang.IllegalArgumentException: No message codec for type: class com.vulog.vwgateway.model.VWApiConversation
Am I missing something?
Vert.x supports serializing JVM primitives, Buffer
s, and JsonObject
s by default. for other custom types you'll need to write your own MessageCodec.
here's some documentation that might be of help:
MessageCodec
implementation. (not shown in this snippet is registration of the codec via EventBus.registerCodec()
.)for my taste i've always used JsonObject
as the messaging medium (as my setups have enabled me to). seems like a hassle to write custom (de)serializers for every domain type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With