Module kflow_gen_demux

This stateless stream processing node splits stream of messages into multiple sub-streams according to an output value of a callback.

Copyright © 2019 Klarna Bank AB (publ)

This module defines the kflow_gen_demux behaviour.
Required callback functions: demux/3.
Optional callback functions: init/1, terminate/1.

Description

This stateless stream processing node splits stream of messages into multiple sub-streams according to an output value of a callback.

Example

   -module(my_demux).
  
   -behavior(kflow_gen_demux).
  
   -export([init/1, demux/3, terminate/1]).
  
   init(Config) ->
     State = do_init(Config),
     State.
  
   demux(Offset, Message, State) ->
     maps:get(key, Message, default).
  
   terminate(State) ->
     do_cleanup(State).

Data Types

callback_fun()

callback_fun() = fun((kflow:offset(), _Message) -> _Route)


Generated by EDoc