static RoutableFactory createMapVisitorMessageFactory() {
        return ProtobufCodecBuilder
                .of(MapVisitorMessage.class, DocapiVisiting.MapVisitorRequest.class)
                .encoder((apiMsg) -> {
                    var builder = DocapiVisiting.MapVisitorRequest.newBuilder();
                    for (var entry : apiMsg.getData().entrySet()) {
                        // FIXME MapVisitorMessage uses Parameters (i.e. string -> bytes) in C++, but string -> string in Java...
                        //  ... but due to this, UTF-8 is effectively enforced anyway. Not that anything actually uses this :I
                        builder.addData(toProtoVisitorParameter(entry.getKey(), entry.getValue().getBytes(StandardCharsets.UTF_8)));
                    }
                    return builder.build();
                })
                .decoder(DocapiVisiting.MapVisitorRequest.parser(), (protoMsg) -> {
                    var msg = new MapVisitorMessage();
                    for (var param : protoMsg.getDataList()) {
                        msg.getData().put(param.getKey(), param.getValue().toStringUtf8());
                    }
                    return msg;
                })
                .build();
    }
Implementation of MessageBus message request/response serialization built around Protocol Buffers.
documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories80.java