-
Notifications
You must be signed in to change notification settings - Fork 393
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
Update Default Partition Logic. #22
Conversation
rhysmccaig
commented
Aug 25, 2016
- Update default partition to -1 so that use of librdkafka's default partitioner is used when one is not specified (Currently defaults to partition 0.)
- Update documentation to indicate key and partition can be specified when producing a message
Producer should default to using librdkafka's default partitioner, rather than defaulting messages to partition number 0.
Pretty new to the contribution thing - let me know if i should do things differently. |
@@ -415,7 +415,7 @@ ProducerMessage::ProducerMessage(v8::Local<v8::Object> obj, Topic * topic): | |||
m_is_empty(true) { | |||
// We have this bad boy now | |||
|
|||
m_partition = GetParameter<int64_t>(obj, "partition", 0); | |||
m_partition = GetParameter<int64_t>(obj, "partition", -1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps better to use the constant: http://docs.confluent.io/2.0.0/clients/librdkafka/classRdKafka_1_1Topic.html#ab69c18779df1c8e150648e640b159654
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah i was just thinking that. Ill update.
Updated to use the RdKafka::Topic::PARTITION_UA constant as the default instead of hardcoding -1. |
Sorry will fix that linting error. |
Updated code formatting to comply with linting rules
@@ -164,7 +164,11 @@ producer.on('ready', function() { | |||
// converted to a Buffer automatically, but we're being | |||
// explicit here for the sake of example. | |||
message: new Buffer('Awesome message'), | |||
|
|||
// for keyed messages, we also specify the key - note that this field is optional | |||
key: 'Stormwind', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Look's good to me. |
Merged. Thanks for the PR! |
Just as an FYI - when submitting a PR I'd generally prefer the commits get squashed. You can do this using GitHub now has this built in so it's super easy for me to do it on the fly during a merge, but it generally helps anyway :) You can do this by running |
Awesome - thanks for the guidance. |