Skip to content

Commit

Permalink
Allow setting max_waiting for pull consumers
Browse files Browse the repository at this point in the history
* it's a pull consumer if `delivery_subject` is empty
  • Loading branch information
Ian Lee authored and Ian Lee committed Jun 26, 2024
1 parent e3cb395 commit ff37126
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion jetstream/resource_jetstream_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,9 @@ func consumerConfigFromResourceData(d *schema.ResourceData) (cfg api.ConsumerCon
}

if cfg.DeliverSubject != "" {
cfg.MaxWaiting = d.Get("max_waiting").(int)
cfg.DeliverGroup = d.Get("delivery_group").(string)
} else {
cfg.MaxWaiting = d.Get("max_waiting").(int)
}

for _, d := range d.Get("backoff").([]any) {
Expand Down
2 changes: 2 additions & 0 deletions jetstream/resource_jetstream_consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ resource "jetstream_consumer" "TEST_C1" {
inactive_threshold = 60
max_delivery = 10
backoff = [30, 60]
max_waiting = 256
metadata = {
foo = "bar"
}
Expand Down Expand Up @@ -114,6 +115,7 @@ func TestResourceConsumer(t *testing.T) {
resource.TestCheckResourceAttr("jetstream_consumer.TEST_C1", "stream_sequence", "0"),
resource.TestCheckResourceAttr("jetstream_consumer.TEST_C1", "description", "new description"),
resource.TestCheckResourceAttr("jetstream_consumer.TEST_C1", "inactive_threshold", "60"),
resource.TestCheckResourceAttr("jetstream_consumer.TEST_C1", "max_waiting", "256"),
),
},
{
Expand Down

0 comments on commit ff37126

Please sign in to comment.