On 09/29/2014 02:15 AM, Denis Shashkov wrote:
Hello! Am I correctly understand Heka's documentation that: 1) inject_message() function is always injecting another message into pipeline
Mostly correct, minus the "another". More on this in #3, below.
2) write_message() function is the only one which can change current processing message
Also correct.
3) (based on 1) current lua decoders (e.g. lua_decoders/apache_access.lua) adds another one message
Nope. When a Lua decoder calls `inject_message()` the first time, it actually reuses and mutates the original input message. If the decoder calls `inject_message()` any additional times, *then* new messages will be generated and injected.
4) (based on 2) filters cannot modify processing message but only inject another one ?
This is correct, and is by design. Once a message hits the router, it might be concurrently delivered to multiple filters and/or outputs. It would be A Bad Idea™ for one of these filters to mutate the message while some other execution thread was also accessing the message. For this reason, `write_message()` is not available in the sandbox we expose to SandboxFilters. SandboxDecoders are in play before the router, so we know we're the only one processing a particular message, and mutating the message is safe. Unfortunately, if you're writing filters in Go we can't prevent you from mutating the messages you're processing. Trust me, though, you don't want to do it, it's a better choice to generate new messages instead. Hope this clarifies! -r _______________________________________________ Heka mailing list [email protected] https://mail.mozilla.org/listinfo/heka

