choose

Enables conditional branching. Evaluates {@link Case} elements in order and runs the first matching flow. If no case matches, an optional trailing {@link Otherwise} is executed. The "otherwise" element must be the last element of the list.

 api:
   port: 2000
   flow:
     - choose:
         - case:
             test: headers['X-Foo'] != null
             flow:
               - return:
                   status: 200
         - case:
             test: headers['X-Bar'] != null
             flow:
               - return:
                   status: 300
         - otherwise:
             - return:
                 status: 400

 

Can be used in:

serviceProxy, chainDef, for, stompProxy, time, if, registration, wsStompReassembler, interceptor, chain and transport

Child Elements

ElementsDescriptionCardinality
case Sets the list of choices. The choices can include "case" and "otherwise" elements to define conditional flows. 0..*
otherwise Sets the list of choices. The choices can include "case" and "otherwise" elements to define conditional flows. 0..*