Skip to content

Commit

Permalink
allow consumer replicas to be edited
Browse files Browse the repository at this point in the history
Signed-off-by: R.I.Pienaar <[email protected]>
  • Loading branch information
ripienaar committed Dec 2, 2022
1 parent 3d1dad1 commit e34017f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 5 additions & 1 deletion cli/consumer_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ func configureConsumerCommand(app commandHost) {
f.Flag("wait", "Acknowledgement waiting time").Default("-1s").DurationVar(&c.ackWait)
if !edit {
f.Flag("inactive-threshold", "How long to allow an ephemeral consumer to be idle before removing it").PlaceHolder("THRESHOLD").DurationVar(&c.inactiveThreshold)
f.Flag("replicas", "Sets a custom replica count rather than inherit from the stream").IntVar(&c.replicas)
f.Flag("memory", "Force the consumer state to be stored in memory rather than inherit from the stream").UnNegatableBoolVar(&c.memory)
}
f.Flag("replicas", "Sets a custom replica count rather than inherit from the stream").IntVar(&c.replicas)
}

cons := app.Command("consumer", "JetStream Consumer management").Alias("con").Alias("obs").Alias("c")
Expand Down Expand Up @@ -357,6 +357,10 @@ func (c *consumerCmd) editAction(pc *fisk.ParseContext) error {
if c.filterSubject != "_unset_" {
ncfg.FilterSubject = c.filterSubject
}

if c.replicas > 0 {
ncfg.Replicas = c.replicas
}
}

// sort strings to subject lists that only differ in ordering is considered equal
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/guptarohit/asciigraph v0.5.5
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/klauspost/compress v1.15.12
github.com/nats-io/jsm.go v0.0.36-0.20221202101040-65db8f7ffa60
github.com/nats-io/jsm.go v0.0.36-0.20221202132938-f7d702bd0bcf
github.com/nats-io/nats-server/v2 v2.9.9-0.20221128185543-14f40b93b51e
github.com/nats-io/nats.go v1.20.0
github.com/nats-io/nuid v1.0.1
Expand All @@ -42,7 +42,6 @@ require (
github.com/nats-io/nkeys v0.3.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
go.uber.org/automaxprocs v1.5.1 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/time v0.1.0 // indirect
Expand Down
8 changes: 2 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,10 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nats-io/jsm.go v0.0.36-0.20221202101040-65db8f7ffa60 h1:wjDKZzJKHCCD+OjJSyBfpg4SIYZ5crOvByor5ZlELBo=
github.com/nats-io/jsm.go v0.0.36-0.20221202101040-65db8f7ffa60/go.mod h1:gVLAvWHq7xjYwRH7KEsrVDBhm7jCA4UWL9Bor+g9KgI=
github.com/nats-io/jsm.go v0.0.36-0.20221202132938-f7d702bd0bcf h1:BN43mLlRTw4x+EDsads26ixWqzzdILVcTGK5xc4ZHnI=
github.com/nats-io/jsm.go v0.0.36-0.20221202132938-f7d702bd0bcf/go.mod h1:uOd9HvMHwjs30ROjkEV/6T8Q7NQCeAAylpjgBHWNb6M=
github.com/nats-io/jwt/v2 v2.3.0 h1:z2mA1a7tIf5ShggOFlR1oBPgd6hGqcDYsISxZByUzdI=
github.com/nats-io/jwt/v2 v2.3.0/go.mod h1:0tqz9Hlu6bCBFLWAASKhE5vUA4c24L9KPUUgvwumE/k=
github.com/nats-io/nats-server/v2 v2.9.8 h1:jgxZsv+A3Reb3MgwxaINcNq/za8xZInKhDg9Q0cGN1o=
github.com/nats-io/nats-server/v2 v2.9.8/go.mod h1:AB6hAnGZDlYfqb7CTAm66ZKMZy9DpfierY1/PbpvI2g=
github.com/nats-io/nats-server/v2 v2.9.9-0.20221128185543-14f40b93b51e h1:RuZ6tfwWVduB9eoBcyrqhGiLcYHOlHV1vlUn6igC9Es=
github.com/nats-io/nats-server/v2 v2.9.9-0.20221128185543-14f40b93b51e/go.mod h1:AB6hAnGZDlYfqb7CTAm66ZKMZy9DpfierY1/PbpvI2g=
github.com/nats-io/nats.go v1.20.0 h1:T8JJnQfVSdh1CzGiwAOv5hEobYCBho/0EupGznYw0oM=
Expand Down Expand Up @@ -277,8 +275,6 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.uber.org/automaxprocs v1.5.1 h1:e1YG66Lrk73dn4qhg8WFSvhF0JuFQF0ERIp4rpuV8Qk=
go.uber.org/automaxprocs v1.5.1/go.mod h1:BF4eumQw0P9GtnuxxovUd06vwm1o18oMzFtK66vU6XU=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand Down

0 comments on commit e34017f

Please sign in to comment.