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

Update Default Partition Logic. #22

Merged
merged 5 commits into from
Aug 25, 2016
Merged

Update Default Partition Logic. #22

merged 5 commits into from
Aug 25, 2016

Conversation

rhysmccaig
Copy link
Contributor

  • 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.
@rhysmccaig
Copy link
Contributor Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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.

@rhysmccaig
Copy link
Contributor Author

Updated to use the RdKafka::Topic::PARTITION_UA constant as the default instead of hardcoding -1.

@rhysmccaig
Copy link
Contributor Author

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',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@webmakersteve
Copy link
Contributor

Look's good to me. -1 makes much more sense as a default partition - and was actually what I thought I was doing already. Thanks for catching this!

@webmakersteve webmakersteve merged commit de2f193 into Blizzard:master Aug 25, 2016
@webmakersteve
Copy link
Contributor

Merged. Thanks for the PR!

@webmakersteve
Copy link
Contributor

Just as an FYI - when submitting a PR I'd generally prefer the commits get squashed. You can do this using git's interactive rebase.

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 git rebase -i HEAD~${NUMBER_OF_COMMITS}. Then you can p commits to keep and s commits to merge. Then at the end you will rewrite the commit message. After you do that you can -f push to your branch and it will automatically update the PR without having to make a separate commit.

@rhysmccaig
Copy link
Contributor Author

Awesome - thanks for the guidance.

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

Successfully merging this pull request may close these issues.

None yet

4 participants