Module kflow_route_dependent_config

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).

Copyright © 2020 Klarna Bank AB (publ)

Description

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).

Example

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}}

Data Types

config()

config() = {config_patch_fun(Cfg), kflow:node_spec(Cfg)}

config_patch_fun()

config_patch_fun(Cfg) = fun((_Route, Cfg) -> Cfg)


Generated by EDoc