Bird
Raised Fist0

Given this transform chain configuration:

medium📝 Predict Output Q4 of Q15
Kafka - Connect
Given this transform chain configuration:
transforms=AddPrefix,ReplaceField
transforms.AddPrefix.type=org.apache.kafka.connect.transforms.RegexRouter
transforms.AddPrefix.regex=^(.*)$
transforms.AddPrefix.replacement=prefix_$1
transforms.ReplaceField.type=org.apache.kafka.connect.transforms.ReplaceField$Value
transforms.ReplaceField.renames=oldField:newField

What will be the new topic name and field rename for a record originally in topic 'mytopic' with field 'oldField'?
ATopic: prefix_mytopic, Field unchanged
BTopic: mytopic, Field renamed from newField to oldField
CTopic: prefix_mytopic, Field renamed from oldField to newField
DTopic: mytopic, Field unchanged
Step-by-Step Solution
Solution:
  1. Step 1: Analyze AddPrefix transform

    This transform renames the topic by adding 'prefix_' before the original topic name, so 'mytopic' becomes 'prefix_mytopic'.
  2. Step 2: Analyze ReplaceField transform

    This transform renames the field 'oldField' to 'newField' in the record's value.
  3. Final Answer:

    Topic: prefix_mytopic, Field renamed from oldField to newField -> Option C
  4. Quick Check:

    Transform chain changes topic and field as configured [OK]
Quick Trick: Transforms apply in order: topic rename then field rename [OK]
Common Mistakes:
MISTAKES
  • Confusing field rename direction
  • Ignoring topic rename transform
  • Assuming transforms do not change topic

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes