Module kflow_route_dependent

This wrapper module allows to make 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 a regular stateless stream processing node dependent on the route (head element of the route, to be precise). NOTE: This module will intentionally crash when used with a stateful callback module.

Example

The following example illustrates how to patch config of kflow_postgres table depending on the route:

   {demux, fun(_Offset, [#{value := N} | _]) ->
             if N rem 2 =:= 0 -> even;
                true ->          odd
             end
           end},
   {route_dependent,
      fun(Route) ->
        Table = case Route of
                  odd  -> "odds";
                  even -> "evens"
                end,
        {map, kflow_postgres, #{ database => #{host => "localhost"}
                               , table    => Table
                               }}
      end}

Data Types

callback_fun()

callback_fun() = fun((_RouteHd::term()) -> kflow_pipe:node_spec())


Generated by EDoc