Skip to content

Commit

Permalink
catch 400 in kafka consumer group creation
Browse files Browse the repository at this point in the history
this 400 is because kafka consumer group creation doesn't need to happen
on clusters that have enough credentials to use any consumer group. We
don't need to error here

sample output:

```
$ heroku kafka:consumer-groups:create greetings; echo $?
Creating consumer group greetings... done
 ▸    kafka-REDACTED-36649 does not need consumer groups managed explicitly, so this command does nothing
0
```
  • Loading branch information
tcrayford committed Feb 14, 2017
1 parent 9d5c791 commit 2278811
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion commands/consumer_groups_create.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function * createConsumerGroup (context, heroku) {
if (context.args.CLUSTER) {
msg += ` on ${context.args.CLUSTER}`
}
var created = true

yield cli.action(msg, co(function * () {
return yield request(heroku, {
Expand All @@ -23,10 +24,19 @@ function * createConsumerGroup (context, heroku) {
}
},
path: `/data/kafka/${VERSION}/clusters/${addon.id}/consumer_groups`
}).catch(err => {
if (err.statusCode === 400 && err.body.message === 'this command is not required or enabled on dedicated clusters') {
created = false
cli.warn(`${cli.color.addon(addon.name)} does not need consumer groups managed explicitly, so this command does nothing`)
} else {
throw err
}
})
}))

cli.log(`Use \`heroku kafka:consumer-groups:info ${context.args.CONSUMER_GROUP}\` to monitor your consumer group.`)
if (created === true) {
cli.log(`Use \`heroku kafka:consumer-groups:info ${context.args.CONSUMER_GROUP}\` to monitor your consumer group.`)
}
})
}

Expand Down

0 comments on commit 2278811

Please sign in to comment.