Most (all?) of the DSL macros follow a similar pattern:
(defn clojure-filter*
(defmacro clojure-filter
(defmacro filter [& body]
(defmacro deffilter
where (deffilter opts {:prepare true} is a shortcut which to (filter which is defined a couple of different ways depending on if you have also passed :params or not. (def or defn)
That's convenient, because you can use it like:
(trident/deftridentfn decode
[tuple coll]
...)
or;
(trident/deftridentfn winnow-batch {:params [hosts] :prepare true}
[conf context]
(let [keep? (some-predicate hosts)]
(trident/tridentfn
(execute [tuple coll]
... do something with keep?))))
defreduceraggregator is different, it makes no internal call to reduceraggregator for you, so you are required to:
(trident/defreduceraggregator error-reducer
(trident/reducer-aggregator
(init []
...)
(reduce [curr tuple]
...)))
where you should probably be able to follow the same convention as others and just supply:
(trident/defreduceraggregator error-reducer
([] (some-init))
([curr tuple] (some-reduce))
A minor nit, but unless i've missed something deliberate in this case I'm happy to raise a PR bringing it in line with the other macros.
Most (all?) of the DSL macros follow a similar pattern:
(defn clojure-filter*
(defmacro clojure-filter
(defmacro filter [& body]
(defmacro deffilter
where (deffilter opts {:prepare true} is a shortcut which to (filter which is defined a couple of different ways depending on if you have also passed :params or not. (def or defn)
That's convenient, because you can use it like:
or;
defreduceraggregator is different, it makes no internal call to reduceraggregator for you, so you are required to:
where you should probably be able to follow the same convention as others and just supply:
A minor nit, but unless i've missed something deliberate in this case I'm happy to raise a PR bringing it in line with the other macros.