We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 740344c commit 80c58e8Copy full SHA for 80c58e8
lib/producer.js
@@ -75,7 +75,7 @@ function Producer(conf, topicConf) {
75
this.globalConfig = conf;
76
this.topicConfig = topicConf;
77
this.defaultTopic = gTopic || null;
78
- this.defaultPartition = gPart || null;
+ this.defaultPartition = gPart == null ? -1 : gPart;
79
80
this.outstandingMessages = 0;
81
this.sentMessages = 0;
@@ -189,7 +189,7 @@ Producer.prototype.produceSync = function(msg) {
189
this.sentMessages++;
190
191
var topic = msg.topic || false;
192
- var partition = msg.partition || this.defaultPartition;
+ var partition = msg.partition == null ? this.defaultPartition : msg.partition;
193
194
if (!topic) {
195
throw new TypeError('"topic" needs to be set');
0 commit comments