storm-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [storm] srdo commented on issue #3165: 'kafkaSpoutConfig' can be 'protected'
Date Sat, 16 Nov 2019 09:16:56 GMT
srdo commented on issue #3165: 'kafkaSpoutConfig' can be 'protected'
URL: https://github.com/apache/storm/pull/3165#issuecomment-554619841
 
 
   @jacobtolar No, I want to discourage subclassing entirely. I'd much rather encourage people
to wrap the spout than to extend it, as that's less likely to break if we make changes internally
in the spout.
   
   What you're trying to do sounds very reasonable, but it sounds like you could do it by
composition as well. So you'd have something like
   ```
   class YourSpout extends BaseRichSpout {
   private final KafkaSpout wrapped;
   private final KafkaSpoutConfig config;
   
   public YourSpout(KafkaSpoutConfig config) {
     wrapped = new KafkaSpout(config)
     this.config = config;
   }
   }
   ```
   
   and then you'd provide implementations of the spout methods that call the wrapped methods,
and also do your tracking. This 
   
   If you need additional hooks for e.g. knowing when a tuple has been discarded by the spout,
we could add them to https://github.com/apache/storm/blob/master/external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/KafkaTupleListener.java
   
   What do you think?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message