Aggregate

Aggregate is a formatter which can group up further formatter. The ApplyTo settings will be pass on and overwritten in the child formatter. This plugin could be useful to setup complex configs with metadata handling in more readable format.

Parameters

ApplyTo

This value chooses the part of the message the formatting should be applied to. Use “” to target the message payload; other values specify the name of a metadata field to target. This value will also used for further 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 try to use only content based formatter and filter! If a modulator changes the stream of a message the message is NOT routed to this stream anymore.

Parameters (from core.SimpleFormatter)

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.MetadataCopy:
        CopyToKeys: ["foo", "bar"]
    - format.Aggregate:
        ApplyTo: foo
        Modulators:
          - format.Base64Encode
          - format.Double
          - format.Envelope:
              Postfix: "\n"
    - format.Envelope:
        Postfix: "\n"
        ApplyTo: bar
# same config as
exampleConsumerB:
  Type: consumer.Console
  Streams: "bar"
  Modulators:
    - format.MetadataCopy:
        CopyToKeys: ["foo", "bar"]
    - format.Base64Encode:
        ApplyTo: foo
    - format.Double:
        ApplyTo: foo
    - format.Envelope:
        Postfix: "\n"
        ApplyTo: foo
    - format.Envelope:
        Postfix: "\n"
        ApplyTo: bar