Coder Social home page Coder Social logo

Comments (1)

Jeffail avatar Jeffail commented on June 23, 2024

Hey @torfjor, the documentation is outdated and pretty unhelpful but the behaviour is "correct" in the sense that it's intentional. Within a traditional mapping the new message being created, and the message that is being fed into the mapping, are the same, and so @ syntax only differs from the metadata (and meta) function in so far as changes made within the mapping are not reflected by the metadata function as it references a read-only instance of the source message.

The result_map works slightly differently, as the message being created is a mutation of the message as it was before the branch processors were enacted, and the message being fed into the mapping is the newly created message that resulted from the branch processors. This means that @ and metadata can yield entirely different metadata values as one is reading from the old message and one is reading from the new one.

We have a small section on the branch page that briefly explains the behaviour: https://www.benthos.dev/docs/components/processors/branch#metadata. However, the docs reference the older meta function and it could definitely do with being fleshed out a bit.

from benthos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.