numaproj / numaflow-java

Numaflow Java SDK
Apache License 2.0
22 stars 10 forks source link

feat: introducing factory for reducer #22

Closed yhl25 closed 1 year ago

yhl25 commented 1 year ago

What's the main benefit of introducing a factory for reducer?

With our current design, the Reducer cannot accept constructor parameters provided by the user because the user has no control over Reducer creation. With the factory, we hand over the control to the user for Reducer creation so that the user can define the way the Reducer should be instantiated, that way any user parameters can be passed to the constructor using the factory.

KeranYang commented 1 year ago

With the factory, we hand over the control to the user for Reducer creation so that the user can define the way the Reducer should be instantiated, that way any user parameters can be passed to the constructor using the factory.

Got it. like what we implemented in EvenOddCounterFactory where parameters in config are passed in. Thanks for the explanation.