The format of a condition is similar to other Benthos types:
condition:text:operator: equalsarg: hello world
And is usually found as the child of a processor:
pipeline:processors:- filter_parts:text:operator: equalsarg: hello world
Batching and Multipart Messages
All conditions can be applied to a multipart message, which is synonymous with a batch. Some conditions target a specific part of a message batch, and require you specify the target index with the field
Some processors such as
filter apply its conditions across the whole batch. Whereas other processors such as
filter_parts will apply its conditions on each part of a batch individually, in which case the condition acts as if it were referencing a single message batch.
Part indexes can be negative, and if so the part will be selected from the end counting backwards starting from -1. E.g. if part = -1 then the selected part will be the last part of the message, if part = -2 then the part before the last element with be selected, and so on.
Sometimes large chunks of logic are reused across processors, or nested multiple times as branches of a larger condition. It is possible to avoid writing duplicate condition configs by using the resource condition.