context_switch

context_switch #

Description #

context_switch filter can be used to use context variables for conditional judgment and achieve flexible jumps.

Configuration Example #

A simple example is as follows:

flow:
  - name: context_switch
    filter:
      - context_switch:
          context: logging.month
          default_flow: echo_message_not_found
          switch:
            - case: ["02","01"]
              action: redirect_flow
              flow: echo_message_01_02
            - case: ["03"]
              action: redirect_flow
              flow: echo_message_03

Parameter Description #

NameTypeDescription
contextstringThe name of context
skip_errorboolWhether to ignore the error and returned directly, such like the context variable does not exist
default_actionstringSet the default action,could be redirect_flow or drop,default redirect_flow
default_flowstringSet the default flow
stringify_valueboolWhether to stringify the value,default true
continueboolWhether to continue the flow after hit. Request returns immediately after it is set to false. The default value is false.
switcharraySwitched by some cases
switch[i].case[]stringMatched criteria
switch[i].actionstringThe action when met the case,could be redirect_flow or drop,default redirect_flow
switch[i].flowstringWhen action is redirect_flow,the flow to redirect,or will use the default flow
Edit Edit this page