Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Producing Multiple Messages ? #11

Open
fsck-mount opened this issue Apr 21, 2017 · 4 comments
Open

Producing Multiple Messages ? #11

fsck-mount opened this issue Apr 21, 2017 · 4 comments

Comments

@fsck-mount
Copy link
Contributor

Hi ..,

Can we produce multiple messages at the same time ?
You have provided the example to send single string message. Is it possible to send multiple ( List of messages ) at one go like kafka-node?

var StringProducer = require('kafka-java-bridge').StringProducer;
var BinaryProducer = require('kafka-java-bridge').BinaryProducer;

var stringProducer = new StringProducer({bootstrapServers: "broker1:9092, broker2:9092"});
var binaryProducer = new BinaryProducer({zookeeperUrl: "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181/kafka"});

const buf = new Buffer([0x0, 0x1, 0x2, 0x3, 0x4]);
binaryProducer.send("myBinaryTopic", buf, function(err, msgMetadata){
    console.log('send msg cb. err = ' + err + '. metadata = ' + JSON.stringify(msgMetadata));
});
stringProducer.send("myStringTopic", ["stringone", "stringtwo"], function(err, msgMetadata){
    console.log('send msg cb. err = ' + err + '. metadata = ' + JSON.stringify(msgMetadata));
});

process.on('SIGINT', function() {
    stringProducer.close(function(err){
        binaryProducer.close(function(err) {
            process.exit();
        });
    });
});
@1ManSmoking
Copy link
Contributor

Hi,

No, didn't implement that.
Underlying java implementation takes messages one by one, so no special value for us to implement list api for send.
You can implement a small utility/wrapper func in your code to do that if you need it.

BR,
Eli

@fsck-mount
Copy link
Contributor Author

@1ManSmoking,

Can we consider that as feature request?

@1ManSmoking
Copy link
Contributor

Sure.
Don't think we'll implement anytime soon though :)

@fsck-mount
Copy link
Contributor Author

@1ManSmoking , that's fine. If you have, feature requirements or roadmaps. Please share.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants