wolfstudy commented on pull request #308:
URL: https://github.com/apache/pulsar-client-go/pull/308#issuecomment-654545962


   > The Chan() method just returns the internal channel, so there would be 
nothing preventing me from writing into that channel, no?
   
   The `MessageChannel` in consumer options is defined as a channel that can be 
read and written at the same time, and the channel returned in 
`consumer.Chan()` is a read-only channel, and the user can only read data from 
it.
   
   ```
   MessageChannel chan ConsumerMessage
   ```
   vs
   ```
   Chan() <-chan ConsumerMessage
   ```
   
   Yes, this is an action that will break API compatibility, but I still think 
that directly exposing a readable and writable channel is a dangerous action.  
   
   > In all the cases, this would just impact the client itself, not the 
broker, so I don't think it's an issue.
   
   Yes, Because we currently have a safer way to replace the behavior of the 
`MessageChannel` option. In other words, we should design to ensure that users 
are exposed to unsafe operations as little as possible, right?
   
   
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to