Open bn-darindouglass-zz opened 4 years ago
This is quite a common pattern, we opted for having a list of predicates as you tend to want to check multiple things before moving on, so [stream topic & preds]
as the signature. Still yes this would be a helpful thing to add to jackdaw
@mt3593 this is how the fn looks now (taken from the tests):
(-> builder
(k/kstream topic-a)
(k/divert? {mod-four? topic-four
mod-five? topic-five
mod-seven? topic-seven})
(k/to topic-rest)))
Bringing in context from Slack:
Some background: for one of our kstreams apps we have a util function call divert? that'll push off a record if a given predicate is true (i.e. to a failure topic, etc):
This abstraction, IMO, would feel really good in the library proper because it provides a useful layer on top of j/branch to handle what i'd think is a common use-case (again, failure topics, etc);