static RoutableFactory createVisitorInfoMessageFactory() {
        return ProtobufCodecBuilder
                .of(VisitorInfoMessage.class, DocapiVisiting.VisitorInfoRequest.class)
                .encoder((apiMsg) -> {
                    var builder = DocapiVisiting.VisitorInfoRequest.newBuilder()
                            .setErrorMessage(apiMsg.getErrorMessage());
                    for (var id : apiMsg.getFinishedBuckets()) {
                        builder.addFinishedBuckets(toProtoBucketId(id));
                    }
                    return builder.build();
                })
                .decoder(DocapiVisiting.VisitorInfoRequest.parser(), (protoMsg) -> {
                    var msg = new VisitorInfoMessage();
                    msg.setErrorMessage(protoMsg.getErrorMessage());
                    for (var protoId : protoMsg.getFinishedBucketsList()) {
                        msg.getFinishedBuckets().add(fromProtoBucketId(protoId));
                    }
                    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