Copyright © 2020 Klarna Bank AB (publ)
This wrapper module allows to make config of a regular stateless stream processing node dependent on the route (head element of the route, to be precise).
The following example illustrates how to patch config of
kflow_postgres
table depending on the route:
{demux, fun([#{value := N} | _]) -> if N rem 2 =:= 0 -> even; true -> odd end}, {route_dependent_config, fun(odd, OriginalConfig) -> OriginalConfig#{table => "odds"}; (even, OriginalConfig) -> OriginalCOnfig#{table => "evens"} end, {map, kflow_postgres, OriginalConfig}}
config() = {config_patch_fun(Cfg), kflow:node_spec(Cfg)}
config_patch_fun(Cfg) = fun((_Route, Cfg) -> Cfg)
Generated by EDoc