eolivelli commented on issue #12087:
URL: https://github.com/apache/pulsar/issues/12087#issuecomment-922748959
@BewareMyPower
I think that we have to think more in general about these extensibility
points that we add to Pulsar, especially on the client.
On one hand we need the power to access the internals of Pulsar (and use
internal APIs, Netty....)
On the other hand we must provide to the end user something that:
- it is able to deal with backward/forward compatibility
- it does not add additional dependencies on the client (pulsar-common??)
I believe that those things can only be implemented if we create a public
API and maintain it, so we have to create public interfaces in
pulsar-client-api module that represent the internal components that we want to
manage.
For instance we cannot expose Netty here, because in that case clients that
use a Shaded version of Netty will not work.
We do not want to access Broker Message Metadata....
so we need something like:
`ByteBuffer convert(MessageContext message, ByteBuffer content)` -> No good,
ByteBuffer does not fully represent ByteBuf
or
`byte[] convert(MessageContext message, byte[] content) `-> very bad,
everybody knows...
or
`Payload convert(MessageContext message, Payload payload)`
with
```
interface MessageContext {
... getMetadata(....)
}
```
and a high level wrapper
```
interface Payload {
int size()
getInputStream()
copyTo(....)
static Payload wrap(byte[])
static Payload wrap(ByteBuffer....)
...add whatever is needed...
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]