Copy

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

Parameters

Source

Defines the key to copy, i.e. the “source” of a copy operation. Target 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.

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 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.Copy:
      Target: key
    - formatter.Identifier
      Generator: hash
      Target: key