static RoutableFactory createGetDocumentMessageFactory() {
        return ProtobufCodecBuilder
                .of(GetDocumentMessage.class, DocapiFeed.GetDocumentRequest.class)
                .encoder((apiMsg) ->
                        DocapiFeed.GetDocumentRequest.newBuilder()
                            .setDocumentId(toProtoDocId(apiMsg.getDocumentId()))
                            .setFieldSet(toProtoFieldSet(apiMsg.getFieldSet()))
                            .build())
                .decoder(DocapiFeed.GetDocumentRequest.parser(), (protoMsg) ->
                        new GetDocumentMessage(
                                fromProtoDocId(protoMsg.getDocumentId()),
                                fromProtoFieldSet(protoMsg.getFieldSet())))
                .build();
    }
Implementation of MessageBus message request/response serialization built around Protocol Buffers.
documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories80.java