alibaba / alibaba-rsocket-broker

Alibaba RSocket Broker: Mesh, Streaming & IoT
https://alibroker.info
Apache License 2.0
763 stars 165 forks source link

在 wiki 文章《RSocket二进制和流式数据支持: RSocket Binary》中的一些疑问 #233

Closed shareisall closed 1 year ago

shareisall commented 1 year ago

1、“ByteBuffer方式”章节第一段代码中(即UserService接口)的updateAvatar默认方法里调用的“findByIdOrNick(byteBuf)”是不是搞错了?应该是“ updateAvatar(byteBuf)”才对吧?

2、“二进制作为返回值”章节中提到是 ByteBuf 返回值类型,但演示代码的接口方法返回值类型又是 ByteBuffer,文字说的和代码要演示的是同一个内容吗?

linux-china commented 1 year ago

是的,这个是一个bug,应该是default method调用interface method,已经调整啦。

default Mono<Void> updateAvatar(Integer id, ByteBuffer avatar) {
       CompositeByteBuf byteBuf = PooledByteBufAllocator.DEFAULT.compositeDirectBuffer(2, toByteBuf(id), toByteBuf(avatar));
       return updateAvatar(byteBuf);
    }