Skip to main content


Benthos processors are functions applied to messages passing through a pipeline. The function signature allows a processor to mutate or drop messages depending on the content of the message. There are many types on offer but the most powerful is the bloblang processor.

Processors are set via config, and depending on where in the config they are placed they will be run either immediately after a specific input (set in the input section), on all messages (set in the pipeline section) or before a specific output (set in the output section). Most processors apply to all messages and can be placed in the pipeline section:

threads: 1
- label: my_cool_mapping
bloblang: |
root.message = this
root.meta.link_count = this.links.length()

The threads field in the pipeline section determines how many parallel processing threads are created. You can read more about parallel processing in the pipeline guide.


Processors have an optional field label that can uniquely identify them in observability data such as metrics and logs. This can be useful when running configs with multiple nested processors, otherwise their metrics labels will be generated based on their composition. For more information check out the [metrics documentation][metrics.about].

Error Handling

Some processors have conditions whereby they might fail. Rather than throw these messages into the abyss Benthos still attempts to send these messages onwards, and has mechanisms for filtering, recovering or dead-letter queuing messages that have failed which can be read about here.

Using Processors as Outputs

It might be the case that a processor that results in a side effect, such as the sql_insert or redis processors, is the only side effect of a pipeline, and therefore could be considered the output.

In such cases it's possible to place these processors within a reject output so that they behave the same as regular outputs, where success results in dropping the message with an acknowledgement and failure results in a nack (or retry):

reject: 'failed to send data: ${! error() }'
- try:
- redis:
url: tcp://localhost:6379
operator: sadd
key: ${! json("foo") }
- bloblang: root = deleted()

The way this works is that if your processor with the side effect (redis in this case) succeeds then the final bloblang processor deletes the message which results in an acknowledgement. If the processor fails then the try block exits early without executing the bloblang processor and instead the message is routed to the reject output, which nacks the message with an error message containing the error obtained from the redis processor.


Processors that specialize in restructuring messages.


Batching and Multiple Part Messages

All Benthos processors support multiple part messages, which are synonymous with batches. This enables some cool windowed processing capabilities.

Many processors are able to perform their behaviours on specific parts of a message batch, or on all parts, and have a field parts for specifying an array of part indexes they should apply to. If the list of target parts is empty these processors will be applied to all message parts.

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 will be selected, and so on.

Some processors such as dedupe act across an entire batch, when instead we might like to perform them on individual messages of a batch. In this case the for_each processor can be used.

You can read more about batching in this document.