I then produce my messages and trying to produce them in order:
for (var i = 0; i < maxMessages; i++) {
var value = Buffer.from(key-customer${randomIntFromInterval(1,4)}-${i});
var key = key-customer${randomIntFromInterval(1,4)};
// if partition is set to -1, librdkafka will use the default partitioner
var partition = -1;
var headers = [
{ header: "header value" }
]
console.log(produced message with key ${key} and message ${value});
producer.produce(topicName, partition, value, key, Date.now(), "", headers);
await sleep(100);
}
Environment Information
Steps to Reproduce I configured a producer as follows:
const producer = new Kafka.Producer({ ...ClientConfig, 'dr_msg_cb': true, retries: 10, ['message.max.bytes'] : 1000000, // 1mb ['enable.auto.commit'] : true, 'enable.idempotence' : true, 'acks' : 'all', // this value is automatically overwritten by 'enable.idempotence' 'max.in.flight.requests.per.connection' : 5, 'queuing.strategy' : 'fifo', 'security.protocol': 'ssl', 'ssl.certificate.location': ".......cer", 'ssl.keystore.location': ".....pfx", 'ssl.keystore.password': process.env.ESP_KEYSTORE_PASSWORD_DT, 'ssl.ca.location': '.....pem',
'client.id': 'redacted', });
I then produce my messages and trying to produce them in order: for (var i = 0; i < maxMessages; i++) { var value = Buffer.from(
key-customer${randomIntFromInterval(1,4)}-${i}
); var key =key-customer${randomIntFromInterval(1,4)}
; // if partition is set to -1, librdkafka will use the default partitioner var partition = -1; var headers = [ { header: "header value" } ] console.log(produced message with key ${key} and message ${value}
); producer.produce(topicName, partition, value, key, Date.now(), "", headers); await sleep(100); }this produces the following messages in order:![image](https://github.com/Blizzard/node-rdkafka/assets/15813315/2706b3e8-9c3b-483b-92db-f8f268adcb09)
when I later consume these messages, using
stream.on('data', (message) => { console.log('Got message: ' + message);
they are not consumed in the order that I produced them;![image](https://github.com/Blizzard/node-rdkafka/assets/15813315/dc252141-0d74-4db2-bfa3-9e6b09ee3e06)
I'm really not sure what I'm doing wrong. Any help is greatly appreciated.