static RoutableFactory createGetDocumentReplyFactory() {
        return ProtobufCodecBuilder
                .of(GetDocumentReply.class, DocapiFeed.GetDocumentResponse.class)
                .encoder((apiReply) -> {
                    var builder = DocapiFeed.GetDocumentResponse.newBuilder()
                            .setLastModified(apiReply.getLastModified());
                    var maybeDoc = apiReply.getDocument();
                    if (maybeDoc != null) {
                        builder.setDocument(toProtoDocument(serializeDoc(maybeDoc)));
                    }
                    return builder.build();
                })
                .decoderWithRepo(DocapiFeed.GetDocumentResponse.parser(), (protoReply, repo) -> {
                    GetDocumentReply reply;
                    if (protoReply.hasDocument()) {
                        var doc = fromProtoDocument(protoReply.getDocument(), repo);
                        doc.setLastModified(protoReply.getLastModified());
                        reply = new GetDocumentReply(doc);
                    } else {
                        reply = new GetDocumentReply(null);
                    }
                    reply.setLastModified(protoReply.getLastModified());
                    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