BewareMyPower commented on code in PR #169:
URL: https://github.com/apache/pulsar-client-cpp/pull/169#discussion_r1109631821
##########
lib/ProducerImplBase.h:
##########
@@ -48,6 +49,9 @@ class ProducerImplBase {
virtual void flushAsync(FlushCallback callback) = 0;
virtual bool isConnected() const = 0;
virtual uint64_t getNumberOfConnectedProducer() = 0;
+
+ protected:
+ ProducerInterceptorsPtr interceptors_;
Review Comment:
Actually I do not suggest adding a field here. We'd better keep this
abstract class like an interface in Java. It works because C++ supports multi
inheritance.
I'd like to move this field to both `ProducerImpl` and
`PartitionedProducerImpl`, then we can initialize this field in the initializer
list like:
```c++
conf_(conf),
interceptors_(interceptors),
```
But I have no objection to multiple inheritance. If you keeps this design,
you can add a constructor to it:
```c++
ProducerImplBase(const ProducerInterceptorsPtr& interceptors) :
interceptors_(interceptors) {}
```
Then initialize it in the initializer list in `ProducerImpl` and
`PartitionedProducerImpl`:
```c++
ProducerImplBase(interceptors),
conf_(conf),
```
--
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]