S- the type of the message being sent
R- the type of the message being received.
public interface MessageCodec<S,R>
Usually the event bus only allows a certain set of message types to be sent across the event bus, including primitive types,
boxed primitive types,
By specifying a message codec you can pass any other type across the event bus, e.g. POJOs.
With a message codec the type sent does not have to be the same as the type received, e.g. you could send
Buffer and have it be received as a
Instances of this class must be thread-safe as they may be used concurrently by different threads.
|Modifier and Type||Method and Description|
Called by Vert.x when a message is decoded from the wire.
Called by Vert.x when marshalling a message to the wire.
The codec name.
Used to identify system codecs.
If a message is sent locally across the event bus, this method is called to transform the message from the sent type S to the received type R
void encodeToWire(Buffer buffer, S s)
buffer- the message should be written into this buffer
s- the message that is being sent
R decodeFromWire(int pos, Buffer buffer)
pos- the position in the buffer where the message should be read from.
buffer- the buffer to read the message from
R transform(S s)
s- the sent message
Copyright © 2023 Eclipse. All rights reserved.