static RoutableFactory createGetBucketStateMessageFactory() {
        return ProtobufCodecBuilder
                .of(GetBucketStateMessage.class, DocapiInspect.GetBucketStateRequest.class)
                .encoder((apiMsg) ->
                        DocapiInspect.GetBucketStateRequest.newBuilder()
                                .setBucketId(toProtoBucketId(apiMsg.getBucketId()))
                                .build())
                .decoder(DocapiInspect.GetBucketStateRequest.parser(), (protoMsg) ->
                        new GetBucketStateMessage(fromProtoBucketId(protoMsg.getBucketId())))
                .build();
    }
Implementation of MessageBus message request/response serialization built around Protocol Buffers.
documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories80.java