xk6-kafka: Q: Unable to read messages

I have a simple kafka setup with the strimzi operator in a kubernetes cluster. I have written a small test which produces to one topic a reads from another (where the results should be placed). Producing works just fine but reading gives me only a single error message “Unable to read messages”.

Excerpt from my test

const brokers = ['kafka-kafka-bootstrap.kafka.svc.cluster.local:9092'];
const sendTopic = 'wmbus';
const recvTopic = 'wmbusDecoded';

const writer = new Writer({
    brokers: brokers,
    topic: sendTopic
});

const reader = new Reader({
    brokers: brokers,
    topic: recvTopic
});

const connection = new Connection({
  address: brokers[0],
});

...

export default function () {
  const count = 1000;

  ...

  let results = reader.consume({ limit: count });

  check(results, {
          "correct number of messages are received": (results) => results.length == count,
      });
}

Did i miss anything? Is there a way to get more meaningful error details?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@mostafa Great! By the way, I just noticed that if there was initial message to read, the functionality works as expected(f.e. send 1 message, read 1, and then read one more)

@MehrCurry Fair enough! I’ll write more docs in the future to fix this issue.