Closed koresar closed 7 years ago
I wonder why you need to do this at all, topic and partition are available as result[0].topic
and result[0].partition
here: https://github.com/oleksiyk/kafka/blob/master/test/01.producer.js#L131
DevOps had that error in a service logs.
2016-10-20T04:08:39.098Z WARN 192-168-1-80.tpgi.com.au Handler for audit-modified:0 failed with
{ [KafkaError: This request is for a topic or partition that does not exist on this broker.]
name: 'KafkaError',
code: 'UnknownTopicOrPartition',
message: 'This request is for a topic or partition that does not exist on this broker.' }
Which they read as "Unknown topic 'audit-modified'".
They investigated the audit-modified
queue back and forth. Found nothing.
Then they googled the error. It lead them to this module. They contacted us. We started an investigation. Then we searched the module source code. And found that consumers are fine. It's just the DevOps didn't understood that the producer is failing. DevOps didn't know the service also can produce, not only consume messages. We explained that they have to create another topic 'critical-change' in the Kafka cluster.
So, this very long story could have been finished much-much quicker by DevOps themselves if they saw something like:
2016-10-20T04:08:39.098Z WARN 192-168-1-80.tpgi.com.au Handler for audit-modified:0 failed with
{ [KafkaError: This request is for a topic or partition that does not exist on this broker.]
name: 'KafkaError',
code: 'UnknownTopicOrPartition',
topic: 'critical-change',
message: 'This request is for a topic or partition that does not exist on this broker.' }
Which reads as "Unknown topic 'critical-change'".
So just catch errors in your handler and log them with all the info you need. The handler is your own code, it just happened that it also used no-kafka to produce messages to another topic. Just catch errors in your handler.
Thanks. Let me try that.
Hello.
Was trying to attach topic and partition to the producer errors. Couldn't implement that successfully. This could be a handy feature for debugging which exactly part of a consumer-producer queue is failing.
Any chance to get help with that? The
it.only()
test fails. :\