static RoutableFactory createCreateVisitorReplyFactory() {
        return ProtobufCodecBuilder
                .of(CreateVisitorReply.class, DocapiVisiting.CreateVisitorResponse.class)
                .encoder((apiReply) -> {
                    var stats = apiReply.getVisitorStatistics();
                    return DocapiVisiting.CreateVisitorResponse.newBuilder()
                            .setLastBucket(toProtoBucketId(apiReply.getLastBucket()))
                            .setStatistics(DocapiVisiting.VisitorStatistics.newBuilder()
                                    .setBucketsVisited(stats.getBucketsVisited())
                                    .setDocumentsVisited(stats.getDocumentsVisited())
                                    .setBytesVisited(stats.getBytesVisited())
                                    .setDocumentsReturned(stats.getDocumentsReturned())
                                    .setBytesReturned(stats.getBytesReturned())
                                    .build())
                            .build();
                })
                .decoder(DocapiVisiting.CreateVisitorResponse.parser(), (protoReply) -> {
                    var reply = new CreateVisitorReply(DocumentProtocol.REPLY_CREATEVISITOR);
                    reply.setLastBucket(fromProtoBucketId(protoReply.getLastBucket()));
                    var protoVs = protoReply.getStatistics();
                    var vs = new VisitorStatistics();
                    vs.setBucketsVisited(protoVs.getBucketsVisited());
                    vs.setDocumentsVisited(protoVs.getDocumentsVisited());
                    vs.setBytesVisited(protoVs.getBytesVisited());
                    vs.setDocumentsReturned(protoVs.getDocumentsReturned());
                    vs.setBytesReturned(protoVs.getBytesReturned());
                    reply.setVisitorStatistics(vs);
                    return reply;
                })
                .build();
    }
Implementation of MessageBus message request/response serialization built around Protocol Buffers.
documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories80.java