Skip to content

Commit

Permalink
Adds back Consumer.Offsets.CommitInterval to fix API
Browse files Browse the repository at this point in the history
fix breaking API change added in
#1164

Fixes:
- bsm/sarama-cluster#308
- bsm/sarama-cluster#307
- lovoo/goka#211
  • Loading branch information
d1egoaz committed Jan 29, 2020
1 parent 20880c3 commit b74b4a2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ type Config struct {
// offsets. This currently requires the manual use of an OffsetManager
// but will eventually be automated.
Offsets struct {
// Deprecated: CommitInterval exists for historical compatibility
// and should not be used. Please use Consumer.Offsets.AutoCommit
CommitInterval time.Duration

// AutoCommit specifies configuration for commit messages automatically.
AutoCommit struct {
// Whether or not to auto-commit updated offsets back to the broker.
// (default enabled).
Expand Down Expand Up @@ -688,6 +693,11 @@ func (c *Config) Validate() error {
return ConfigurationError("Consumer.IsolationLevel must be ReadUncommitted or ReadCommitted")
}

if c.Consumer.Offsets.CommitInterval != 0 {
Logger.Println("Deprecation warning: Consumer.Offsets.CommitInterval exists for historical compatibility" +
" and should not be used. Please use Consumer.Offsets.AutoCommit, the current value will be ignored")
}

// validate IsolationLevel
if c.Consumer.IsolationLevel == ReadCommitted && !c.Version.IsAtLeast(V0_11_0_0) {
return ConfigurationError("ReadCommitted requires Version >= V0_11_0_0")
Expand Down

0 comments on commit b74b4a2

Please sign in to comment.