Skip to content

Commit

Permalink
Allow specifying an encoding for ConsumerGroup
Browse files Browse the repository at this point in the history
This allows binary data to be consumed via ConsumerGroup without corruption, resolving issue SOHU-Co#1131
  • Loading branch information
mishan committed Dec 4, 2018
1 parent e546072 commit e330801
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ var options = {
// An array of partition assignment protocols ordered by preference.
// 'roundrobin' or 'range' string for built ins (see below to pass in custom assignment protocol)
protocol: ['roundrobin'],
encoding: 'utf8', // default is utf8, use 'buffer' for binary data

// Offsets to use for new groups other options could be 'earliest' or 'none' (none will emit an error if no offsets were saved)
// equivalent to Java client's auto.offset.reset
Expand Down
3 changes: 2 additions & 1 deletion lib/consumerGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const DEFAULTS = {
migrateRolling: true,
onRebalance: null,
topicPartitionCheckInterval: 30000,
protocol: ['roundrobin']
protocol: ['roundrobin'],
encoding: 'utf8'
};

function ConsumerGroup (memberOptions, topics) {
Expand Down

0 comments on commit e330801

Please sign in to comment.