Aggregate

Aggregate is a formatter which can group up further formatter. The Source setting will be passed on to all child formatters, overwriting any source value there (if set). This plugin could be useful to setup complex configs with metadata handling in more readable format.

Parameters

Source

This value chooses the part of the message that should be formatted. Use “” to use the message payload; other values specify the name of a metadata field to use. This values is forced to be used by all child modulators. By default this parameter is set to “”.

Modulators

Defines a list of child modulators to be applied to a message when it arrives at this formatter. Please note that everything is still one message. I.e. applying filters twice might not make sense.

Parameters (from core.SimpleFormatter)

Target

This value chooses the part of the message the formatted data should be stored to. Use “” to target the message payload; other values specify the name of a metadata field to target. By default this parameter is set to “”.

ApplyTo

Use this to set Source and Target to the same value. This setting will be ignored if either Source or Target is set to something else but “”. By default this parameter is set to “”.

SkipIfEmpty

When set to true, this formatter will not be applied to data that is empty or - in case of metadata - not existing. By default this parameter is set to false

Examples

This example show a useful case for format.Aggregate plugin:

exampleConsumerA:
  Type: consumer.Console
  Streams: "foo"
  Modulators:
    - format.Aggregate:
        Target: bar
        Modulators:
          - format.Copy
          - format.Envelope:
              Postfix: "\n"
    - format.Aggregate:
        Target: foo
        Modulators:
          - format.Copy
          - format.Base64Encode
          - format.Double
          - format.Envelope:
              Postfix: "\n"
# same config as
exampleConsumerB:
  Type: consumer.Console
  Streams: "bar"
  Modulators:
    - format.Copy:
        Target: bar
    - format.Envelope:
        Target: bar
        Postfix: "\n"
    - format.Copy:
        Target: foo
    - format.Base64Encode:
        Target: foo
    - format.Double:
        Target: foo
    - format.Envelope:
        Postfix: "\n"
        Target: foo