kflow_demux_bridge
is a module that helps keeping track of
multiple states of an intermediate callback module.
Copyright © 2019 Klarna Bank AB (publ)
This module defines the kflow_demux_bridge behaviour.
Required callback functions: fully_processed_offset/1.
kflow_demux_bridge
is a module that helps keeping track of
multiple states of an intermediate callback module. It wraps
around a stateful intermediate CBM and multiplexes its state
according to the value of route
field of upstream messages. It
also rewrites fully_processed_offset
field of the downstream
messages to make sure all unacked messages of all routes get
replayed on pipe restart.
Intermediate CBMs using demux bridge must implement both
kflow_gen
and kflow_demux_bridge
behaviors.
NOTE: fully_processed_offset/1
callback should be a pure
function.
NOTE: It doesn't make much sense to use this wrapper for stateless modules.
NOTE: Callback module that wraps around a callback module may sound like a terrible idea. But in reality it's the only sane way to keep complexity of already difficult-to-understand modules such askflow_gen
or kflow_gen_aggregate
under control. This way
different functionality is contained in different places.
abstract datatype: wrapped()
handle_flush/2 | Wrap handle_flush callback. |
handle_message/3 | Wrap handle_message callback. |
terminate/2 | Wrap terminate callback. |
wrap/2 | Wrap intermediate callback module:. |
handle_flush(State0, Config) -> any()
Wrap handle_flush
callback
handle_message(Msg, State0, Config) -> any()
Wrap handle_message
callback
terminate(S, Config) -> any()
Wrap terminate
callback
wrap(NodeId::kflow:node_id(), IntermediateCbModule::module()) -> {ok, wrapped()}
Wrap intermediate callback module:
Generated by EDoc