Github user knusbaum commented on the pull request:

    https://github.com/apache/storm/pull/1199#issuecomment-196548786
  
     arunmahadevan added a note 3 days ago
    
    > Actually naming the operations wherever specific config needs to be 
applied looks cleaner and it separates out the streaming operations from the 
config specification.
    
    >
    ```
    TridentTopology topo = new TridentTopology();
    TridentState wordCounts = 
        topology.newStream("spout1", spout)
            .name("spout1")
            .each(new Fields("sentence"), new Split(), new Fields("word"))
            .name("split_operation")
            .groupBy(new Fields("word"))
            .persistentAggregate(new MemorymapState.Factory(), new Count(), new 
Fields("count"))
            .name("aggregate");
    ```
    >And then
    ```
    topology.setConfig("spout1", Config.cpuLoad(20).memoryLoad(1024))
                 .setConfig("split_operation", 
Config.cpuLoad(20).memoryLoad(256))
                 .setConfig("aggregate", Config.parallelismHint(6));
    ```
    >The concern with directly adding each config api in Stream is that we 
might want to add more configs in future and then it would mess up the Stream 
api.'
    
    
    This does not work, and would require an overhaul of the way naming works 
right now. First off, your example won't compile. `persistentAggregate` returns 
a `TridentState`, which doesn't have a `name` method. Okay, well we can move 
the name call up to just below the groupBy. It's a little confusing being right 
in the middle, but groupBy returns a `GroupedStream`, which has a name method. 
Unfortunately, you end up with all your bolts being named "b-*-aggregate" 
because 'GroupedStream' just renames the stream before it. In fact, except for 
differentiating between the spout and body, I don't see any existing way to 
give different sections different names, and doing so is not a simple change, 
and not one that is going to be backwards-compatible.
    
    I agree with your point in principle, but how much do we want to change the 
existing API to accommodate it?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to