Skip to content

Commit

Permalink
Remove occurrences of error event
Browse files Browse the repository at this point in the history
  • Loading branch information
webmakersteve committed Mar 24, 2017
1 parent 5383aa6 commit 832326f
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 15 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ producer.on('ready', function() {
});

// Any errors we encounter, including connection errors
producer.on('error', function(err) {
producer.on('event.error', function(err) {
console.error('Error from producer');
console.error(err);
})
Expand Down Expand Up @@ -241,6 +241,7 @@ The following table describes types of events.
| `event` | The `event` event is emitted when `librdkafka` reports an event (if you opted in via the `event_cb` option). |
| `event.log` | The `event.log` event is emitted when logging events come in (if you opted into logging via the `event_cb` option). <br><br>You will need to set a value for `debug` if you want to send information. |
| `event.stats` | The `event.stats` event is emitted when `librdkafka` reports stats (if you opted in). |
| `event.error` | The `event.error` event is emitted when `librdkafka` reports an error |
| `event.throttle` | The `event.throttle` event emitted when `librdkafka` reports throttling. |
| `delivery-report` | The `delivery-report` event is emitted when a delivery report has been found via polling. <br><br>To use this event, you must set `request.required.acks` to `1` or `-1` in topic configuration and `dr_cb` (or `dr_msg_db` if you want the report to contain the message payload) to `true` in the `Producer` constructor options. |

Expand Down
2 changes: 1 addition & 1 deletion bench/producer-raw-rdkafka.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ crypto.randomBytes(4096, function(ex, buffer) {
sendMessage();

})
.on('error', function(err) {
.on('event.error', function(err) {
console.error(err);
process.exit(1);
})
Expand Down
2 changes: 1 addition & 1 deletion bench/producer-rdkafka.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var producer = new Kafka.Producer({
'batch.num.messages': 1000,
});

producer.on('error', function(e) {
producer.on('event.error', function(e) {
console.log(e);
process.exit(1);
});
Expand Down
2 changes: 1 addition & 1 deletion e2e/listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function eventListener(client) {
}

client
.on('error', function (err) {
.on('event.error', function (err) {
console.error(err);
})
.on('event.log', function(event) {
Expand Down
6 changes: 3 additions & 3 deletions examples/consumer-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ var consumer = new Kafka.KafkaConsumer({

var topicName = 'test';

//logging debug messages, if debug is enabled
//logging debug messages, if debug is enabled
consumer.on('event.log', function(log) {
console.log(log);
});

//logging all errors
consumer.on('error', function(err) {
consumer.on('event.error', function(err) {
console.error('Error from consumer');
console.error(err);
});
Expand All @@ -48,7 +48,7 @@ consumer.on('ready', function(arg) {

consumer.on('data', function(m) {
counter++;

//committing offsets every numMessages
if (counter % numMessages === 0) {
console.log('calling commit');
Expand Down
2 changes: 1 addition & 1 deletion examples/consumer.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ stream
}))
.pipe(process.stdout);

consumer.on('error', function(err) {
consumer.on('event.error', function(err) {
console.log(err);
});
```
2 changes: 1 addition & 1 deletion examples/metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ producer.connect()
console.log(i);
console.log(producer.getMetadata());
})
.on('error', function(err) {
.on('event.error', function(err) {
console.log(err);
});
```
2 changes: 1 addition & 1 deletion examples/producer-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ if (cluster.isMaster) {

}, 1000);
producer.connect()
.on('error', function(e) {
.on('event.error', function(e) {
errors++;
errorsArr.push(e);
})
Expand Down
8 changes: 4 additions & 4 deletions examples/producer.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
var Kafka = require('../');

var producer = new Kafka.Producer({
//'debug' : 'all',
//'debug' : 'all',
'metadata.broker.list': 'localhost:9092',
'dr_cb': true //delivery report callback
});

var topicName = 'test';

//logging debug messages, if debug is enabled
//logging debug messages, if debug is enabled
producer.on('event.log', function(log) {
console.log(log);
});

//logging all errors
producer.on('error', function(err) {
producer.on('event.error', function(err) {
console.error('Error from producer');
console.error(err);
});
Expand Down Expand Up @@ -63,7 +63,7 @@ producer.on('ready', function(arg) {
if (counter === maxMessages) {
clearInterval(pollLoop);
producer.disconnect();
}
}
}, 1000);

});
Expand Down
2 changes: 1 addition & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function Client(globalConf, SubClientType, topicConf) {
self._isConnected = false;
// keep the metadata. it still may be useful
})
.on('error', function(err) {
.on('event.error', function(err) {
self.lastError = err;
++self.errorCounter;
});
Expand Down

0 comments on commit 832326f

Please sign in to comment.