Skip to content

Commit bea448f

Browse files
dkorittkialepane21
andauthored
fix: flag option as experimental (#2628)
Co-authored-by: Alessandro Pagnin <ale@wundergraph.com>
1 parent 457b5d8 commit bea448f

File tree

5 files changed

+14
-44
lines changed

5 files changed

+14
-44
lines changed

router-tests/events/nats_events_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ func TestNatsEvents(t *testing.T) {
12131213
},
12141214
ModifyEventsConfiguration: func(cfg *config.EventsConfiguration) {
12151215
for i := range cfg.Providers.Nats {
1216-
cfg.Providers.Nats[i].Consumers.Durable.DeleteOnShutdown = true
1216+
cfg.Providers.Nats[i].DeleteDurableConsumersOnShutdown = true
12171217
}
12181218
},
12191219
})
@@ -1270,7 +1270,7 @@ func TestNatsEvents(t *testing.T) {
12701270
},
12711271
ModifyEventsConfiguration: func(cfg *config.EventsConfiguration) {
12721272
for i := range cfg.Providers.Nats {
1273-
cfg.Providers.Nats[i].Consumers.Durable.DeleteOnShutdown = false
1273+
cfg.Providers.Nats[i].DeleteDurableConsumersOnShutdown = false
12741274
}
12751275
},
12761276
})

router/pkg/config/config.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -616,19 +616,11 @@ type NatsAuthentication struct {
616616
NatsTokenBasedAuthentication `yaml:"token,inline"`
617617
}
618618

619-
type NatsDurableConsumersConfiguration struct {
620-
DeleteOnShutdown bool `yaml:"delete_on_shutdown" envDefault:"false"`
621-
}
622-
623-
type NatsConsumersConfiguration struct {
624-
Durable NatsDurableConsumersConfiguration `yaml:"durable,omitempty"`
625-
}
626-
627619
type NatsEventSource struct {
628-
ID string `yaml:"id,omitempty"`
629-
URL string `yaml:"url,omitempty"`
630-
Authentication *NatsAuthentication `yaml:"authentication,omitempty"`
631-
Consumers NatsConsumersConfiguration `yaml:"consumers,omitempty"`
620+
ID string `yaml:"id,omitempty"`
621+
URL string `yaml:"url,omitempty"`
622+
Authentication *NatsAuthentication `yaml:"authentication,omitempty"`
623+
DeleteDurableConsumersOnShutdown bool `yaml:"experiment_delete_durable_consumers_on_shutdown"`
632624
}
633625

634626
func (n NatsEventSource) GetID() string {

router/pkg/config/config.schema.json

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"properties": {
2121
"token": {
2222
"type": "string",
23-
"description": "The token used to authenticate with other component from Cosmo. Can be ommitted if the router is started with a static execution config."
23+
"description": "The token used to authenticate with other component from Cosmo. Can be omitted if the router is started with a static execution config."
2424
},
2525
"sign_key": {
2626
"type": "string",
@@ -2581,24 +2581,10 @@
25812581
}
25822582
]
25832583
},
2584-
"consumers": {
2585-
"type": "object",
2586-
"description": "Configuration for JetStream consumers managed by this NATS provider.",
2587-
"additionalProperties": false,
2588-
"properties": {
2589-
"durable": {
2590-
"type": "object",
2591-
"description": "Configuration for durable JetStream consumers managed by this NATS provider.",
2592-
"additionalProperties": false,
2593-
"properties": {
2594-
"delete_on_shutdown": {
2595-
"type": "boolean",
2596-
"description": "When enabled, all durable JetStream consumers created by this provider are deleted when the router shuts down normally. Defaults to false.",
2597-
"default": false
2598-
}
2599-
}
2600-
}
2601-
}
2584+
"experiment_delete_durable_consumers_on_shutdown": {
2585+
"type": "boolean",
2586+
"description": "When enabled, all durable JetStream consumers created by this provider are deleted when the router shuts down normally. Defaults to false. NOTE: This option is experimental and may change in future versions.",
2587+
"default": false
26022588
}
26032589
}
26042590
}

router/pkg/config/testdata/config_full.json

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -657,11 +657,7 @@
657657
"ID": "default",
658658
"URL": "nats://localhost:4222",
659659
"Authentication": null,
660-
"Consumers": {
661-
"Durable": {
662-
"DeleteOnShutdown": false
663-
}
664-
}
660+
"DeleteDurableConsumersOnShutdown": false
665661
},
666662
{
667663
"ID": "my-nats",
@@ -673,11 +669,7 @@
673669
},
674670
"Token": null
675671
},
676-
"Consumers": {
677-
"Durable": {
678-
"DeleteOnShutdown": false
679-
}
680-
}
672+
"DeleteDurableConsumersOnShutdown": false
681673
}
682674
],
683675
"Kafka": [

router/pkg/pubsub/nats/provider_builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func buildProvider(ctx context.Context, provider config.NatsEventSource, logger
123123
return nil, fmt.Errorf("failed to build options for Nats provider with ID \"%s\": %w", provider.ID, err)
124124
}
125125

126-
adapter, err := NewAdapter(ctx, logger, provider.URL, options, hostName, routerListenAddr, provider.Consumers.Durable.DeleteOnShutdown, providerOpts)
126+
adapter, err := NewAdapter(ctx, logger, provider.URL, options, hostName, routerListenAddr, provider.DeleteDurableConsumersOnShutdown, providerOpts)
127127
if err != nil {
128128
return nil, fmt.Errorf("failed to create adapter for Nats provider with ID \"%s\": %w", provider.ID, err)
129129
}

0 commit comments

Comments
 (0)