Skip to main content
Quick navigation

Check the partition of a message produced to Kafka

Add a 'Producer' task to your test scenario

Open the task in edit mode and navigate to the 'Checks' tab in the slide-out component.

Select the + button to create a new check

With the custom input type Field selection (JQ) selected:

  • add .record.partition as the field selection
  • Select type = any and operator =equals
  • With Plain value selected as the input field for the value, add the expected partition

Run your test, and navigate to the Checks tab when the execution is complete to observe the result of your check.

Note to run tests you must have the Testing Agent installed.

In this case, our test failed as the message was not produced into partition 0. Instead, the record was produced into partition 2.

Continue to see how to check the value of an attribute inside a JSON message.