ccann / gregor

Lightweight Clojure bindings for Apache Kafka
Eclipse Public License 1.0
23 stars 5 forks source link

Guard against metadata being nil when callback is called #4

Closed neilprosser closed 6 years ago

neilprosser commented 6 years ago

When the send-then callback is called during an error case, it will be called with nil for the value of metadata (https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java#L917).

This PR adds a bit of defensive code to avoid a NullPointerException and make callbacks work for sends which have gone wrong.