MetadataCopy

This formatter sets metadata fields by copying data from the message’s payload or from other metadata fields.

Parameters

Key

Defines the key to copy, i.e. the “source”. ApplyTo will define the target of the copy, i.e. the “destination”. An empty string will use the message payload as source. By default this parameter is set to an empty string (i.e. payload).

Mode

Defines the copy mode to use. This can be one of “append”, “prepend” or “replace”. By default this parameter is set to “replace”.

Separator

When using mode prepend or append, defines the characters inserted between source and destination. By default this parameter is set to an empty string.

CopyToKeys

DEPRECATED. A list of meta data keys to copy the payload or metadata content to. If this field contains at least one value, mode is set to replace and the key field is ignored. By default this parameter is set to an empty list.

Parameters (from core.SimpleFormatter)

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. 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 copies the payload to the field key and applies a hash on it contain a hash over the complete payload.

exampleConsumer:
  Type: consumer.Console
  Streams: "*"
  Modulators:
    - format.MetadataCopy:
      ApplyTo: key
    - formatter.Identifier
      Generator: hash
      ApplyTo: key