Skip to main content

Bloblang Beta

· 2 min read

As of this weekend (and Benthos v3.13) you can now use a bloblang processor and complementary condition. These components are in a beta phase, which means that based on feedback the mapping language might change in minor ways in upcoming minor releases.

The Motivation

In the last post I outlined my motivations for experimenting with a mapping language. Words are stupid and boring and so to illustrate why a mapping language kicks ass here's a config example using the old processors compared to the new one. Keep in mind that the new version is simpler and performs better.

Using old processors:

pipeline:
processors:
- metadata:
operator: set
key: bar
value: ${!json_field:foo.bar}

- json:
operator: delete
path: foo.bar

- json:
operator: set
path: foo.topic
value: ${!metadata:topic}

- metadata:
operator: delete
key: topic

- conditional:
condition:
jmespath:
query: "foo.baz == 'thing'"
processors:
- json:
operator: set
path: foo.thing_id
value: ${!uuid_v4}

Using Bloblang:

pipeline:
processors:
- bloblang: |
root = this

foo.topic = meta("topic")
meta topic = deleted()

meta bar = foo.bar
foo.bar = deleted()

foo.thing_id = match {
foo.baz == "thing" => uuid_v4()
}

My ultimate intention is to completely eradicate the need for a json, metadata and text processor, as well as a range of others. However, I'll need as much help as possible to get the language right, so please consider testing and feeding back on Github, the Gitter channel, or event @ me on Twitter for the good of blobkind.