Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
1d520ea
chore: add rfc
alepane21 Jul 10, 2025
290aa5f
Add some more description
alepane21 Jul 10, 2025
da3f6a1
feat: improved RFC base on feedback received
alepane21 Jul 11, 2025
82fed9f
chore: clean a bit structures
alepane21 Jul 11, 2025
1252790
chore: small fixes
alepane21 Jul 11, 2025
0008025
chore: fix indentations
alepane21 Jul 11, 2025
26bb7db
chore: small fixes
alepane21 Jul 11, 2025
d909dc0
chore: improved english flow
alepane21 Jul 11, 2025
d032b67
chore: fix wrong logic in an example
alepane21 Jul 11, 2025
9c69cdc
chore: change StreamOnEventFilter meaning of the returned boolean
alepane21 Jul 11, 2025
80f7097
chore: small fixes to example
alepane21 Jul 11, 2025
7969ec9
chore: address feedback
alepane21 Jul 12, 2025
5312f14
chore: limit filter example to inbound events
alepane21 Jul 12, 2025
259b2a0
chore: separate inbound and outbound hooks, added some complete examples
alepane21 Jul 13, 2025
23f3e19
chore: add some comments
alepane21 Jul 13, 2025
4d76c66
chore: moved interfaces and types to an appendix
alepane21 Jul 13, 2025
e35ac47
chore: improve example checks
alepane21 Jul 13, 2025
df62784
chore: improve data structure to expose ProviderId/Type and Specific …
alepane21 Jul 13, 2025
ace1c5c
chore: removed logic in the examples
alepane21 Jul 13, 2025
e6fc78f
chore: add proposal about how we could integrate AsyncAPI
alepane21 Jul 13, 2025
95a3941
core: add usage of FieldName()
alepane21 Jul 13, 2025
5adb360
chore: remove second example
alepane21 Jul 13, 2025
bfe2651
chore: explicit that the second async schema can be used by outside s…
alepane21 Jul 13, 2025
368413e
chore: change sent to published to be more consistent
alepane21 Jul 13, 2025
9015adf
chore: add enums for provider types
alepane21 Jul 13, 2025
cc83382
chore: remove Data and SetData, they break immutability!
alepane21 Jul 13, 2025
b5f188c
chore: FieldName -> RootFieldName
alepane21 Jul 14, 2025
68e7874
chore: improve data mapping description
alepane21 Jul 14, 2025
127a08a
chore: explicit that WriteEvent is writing event only to the current …
alepane21 Jul 14, 2025
083bf70
chore: explicit the WriteEvent behaviour also in the example
alepane21 Jul 14, 2025
ef36c76
chore: add an outlook on the Appendix 2 about a possible evolution
alepane21 Jul 14, 2025
93e4b04
chore: fixes example code to avoid panic on request not authenticated
alepane21 Jul 14, 2025
1fdeec3
chore: add explicit reference to Filtering hook that could be used fo…
alepane21 Jul 14, 2025
d38018e
chore: added description on the event filtering about authorization
alepane21 Jul 14, 2025
1ae023e
Merge branch 'main' into ale/eng-7470-rfc-cosmo-streams-v1-authorizat…
alepane21 Jul 14, 2025
f58970f
chore: add StreamHookError to allow error response customization from…
alepane21 Jul 14, 2025
8ac629c
chore: add more details and an example with kafka
alepane21 Jul 14, 2025
434c61c
chore: add an example on how to use the metadata field
alepane21 Jul 14, 2025
35e8077
fix: ignore marshal error
alepane21 Jul 14, 2025
fa562c9
chore: add PublishEventConfiguration, ProviderType and specialized ev…
alepane21 Jul 15, 2025
7ececf0
chore: remove local file
alepane21 Jul 15, 2025
93db159
Merge branch 'main' into ale/eng-7599-introduce-base-structures-to-pu…
alepane21 Jul 15, 2025
1ec4816
chore: use ProviderID()
alepane21 Jul 15, 2025
b938232
chore: update demo to use no Event structure
alepane21 Jul 15, 2025
f69b4cd
fix: align event configuration format
alepane21 Jul 15, 2025
74f32fc
fix: update MarshalJSONTemplate for new internal event format
alepane21 Jul 15, 2025
1649ef5
chore: remove duplicated test
alepane21 Jul 15, 2025
b83e4ef
chore: improve naming
alepane21 Jul 15, 2025
9ed94fd
chore: make the ADR from the approved RFC
alepane21 Jul 16, 2025
e61ad7a
Merge branch 'main' into ale/eng-7470-rfc-cosmo-streams-v1-authorizat…
alepane21 Jul 16, 2025
62a0882
chore: add an example to adr
alepane21 Jul 16, 2025
7d8a782
Merge branch 'ale/eng-7470-rfc-cosmo-streams-v1-authorization-init-ma…
alepane21 Jul 16, 2025
b4838be
Merge branch 'main' into ale/eng-7599-introduce-base-structures-to-pu…
alepane21 Jul 16, 2025
0e60603
feat: add SubscriptionOnStartHandler
alepane21 Jul 17, 2025
9fc67d2
Merge branch 'main' into ale/eng-7600-add-subscriptiononstarthandler
alepane21 Jul 17, 2025
73c3fb2
feat: add WriteEvent to context
alepane21 Jul 17, 2025
8b3d17b
chore: add test, improve method signature
alepane21 Jul 18, 2025
1977d3a
Merge branch 'main' into ale/eng-7600-add-subscriptiononstarthandler
alepane21 Jul 18, 2025
17984ce
feat: pass down additional event data to pubsub system
alepane21 Jul 18, 2025
0992ef6
chore: add SubscriptionEventUpdater to mockery
alepane21 Jul 18, 2025
6622459
chore: improved structure, add support for start hook also on subgrap…
alepane21 Jul 18, 2025
19ca6fd
chore: update deps
alepane21 Jul 19, 2025
79f05e5
chore: go mod tidy
alepane21 Jul 19, 2025
4b9c8a7
fix: properly escapes values
alepane21 Jul 19, 2025
9257565
chore: align MarshalJSONTemplate and improve the kafka one
alepane21 Jul 21, 2025
d6c6ec6
chore: small fix to MarshalJSONTemplate format
alepane21 Jul 21, 2025
a8b7f7d
chore: use the new subscription hooks on the engine
alepane21 Jul 22, 2025
18bee17
chore: update engine version
alepane21 Jul 22, 2025
bda2ed6
chore: tidy mods of router-tests
alepane21 Jul 22, 2025
5873131
Merge branch 'main' into ale/eng-7600-add-subscriptiononstarthandler
alepane21 Jul 22, 2025
638c6f7
chore: hooks can close subscription and specify custom errors
alepane21 Jul 22, 2025
cf1c868
chore: WriteEvents now calls directly resolveCtx.EmitSubscriptionUpdate
alepane21 Jul 23, 2025
831222e
Merge remote-tracking branch 'origin/main' into ale/eng-7600-add-subs…
alepane21 Jul 23, 2025
89832b9
fix: minor typos on adr
alepane21 Jul 23, 2025
7b8239f
chore: aligned names in the engine with the ones here
alepane21 Jul 23, 2025
9c8609f
chore: use new engine hooks
alepane21 Jul 23, 2025
d6dd642
chore: update engine
alepane21 Jul 23, 2025
6ad6f59
chore: update engine
alepane21 Jul 23, 2025
c330e46
Merge branch 'main' into ale/eng-7600-add-subscriptiononstarthandler
alepane21 Jul 23, 2025
c4dd131
fix: make CustomModuleError panic-free
alepane21 Jul 23, 2025
2e737da
fix: make NewPubSubOnSubscriptionStartHook and NewEngineOnSubscriptio…
alepane21 Jul 23, 2025
6ea1ee1
chore: clarify SubscriptionOnStartHookContext interface
alepane21 Jul 23, 2025
057a01f
chore: small coherency fixes
alepane21 Jul 23, 2025
73292a7
chore: small fixes and made names more coherent
alepane21 Jul 24, 2025
45a71e0
chore: add comments
alepane21 Jul 24, 2025
c58e79a
chore: add headers on kafka publish
alepane21 Jul 24, 2025
7c4a508
chore: use new TryEmitSubscriptionUpdate, added Headers on nats
alepane21 Jul 24, 2025
87faf10
chore: headers were not managed when nats was using channels
alepane21 Jul 24, 2025
4d4e675
Merge branch 'main' into ale/eng-7600-add-subscriptiononstarthandler
alepane21 Jul 24, 2025
9f661f3
chore: update graphql-go-tools to v2.0.0-rc.213 and use new Subscript…
alepane21 Jul 29, 2025
cb6d326
Revert "chore: update graphql-go-tools to v2.0.0-rc.213 and use new S…
alepane21 Jul 29, 2025
bff8717
chore: update graphql-go-tools to v2.0.0-rc.213 and use new Subscript…
alepane21 Jul 29, 2025
21c6366
chore: improve adr
alepane21 Jul 29, 2025
057d0f0
Merge branch 'topic/streams-v1' into ale/eng-7600-add-subscriptionons…
alepane21 Jul 29, 2025
35aceb0
refactor: rename ProviderLifecycle to Lifecycle and replaced hookedda…
alepane21 Jul 30, 2025
85a1bdb
chore: add a description to PubSubSubscriptionDataSource
alepane21 Jul 30, 2025
27e2b84
chore: add PubSubSubscriptionDataSource tests
alepane21 Jul 30, 2025
ffbd209
chore: implement PR suggestions
alepane21 Jul 30, 2025
ed22545
chore: implement suggestion
alepane21 Jul 31, 2025
d014b3a
chore: fix test
alepane21 Jul 31, 2025
82b5521
chore: update go.mod
alepane21 Aug 4, 2025
6ab1463
chore: go mod tidy
alepane21 Aug 4, 2025
4d93bd1
chore: change SubscriptionOnStartHandler to return only the error and…
alepane21 Aug 4, 2025
e309be2
chore: add what changes should be made to cosmo streams hooks with mo…
alepane21 Aug 4, 2025
cfc7a57
chore: add failing test
alepane21 Aug 5, 2025
fca32f6
chore: update engine
alepane21 Aug 5, 2025
61e0ddc
chore: update router
alepane21 Aug 5, 2025
cd9e4e4
chore: update engine
alepane21 Aug 6, 2025
1c4a1a9
chore: update router
alepane21 Aug 6, 2025
ceac255
chore: rename CloseConnection to CloseSubscription
alepane21 Aug 8, 2025
511a172
chore: remove close option from subscription start hook
alepane21 Aug 19, 2025
e34b6fe
chore: use updated engine
alepane21 Aug 19, 2025
70ef951
chore: use update router
alepane21 Aug 19, 2025
fb6c1a4
chore: fix test for new behaviour when an error is returned
alepane21 Aug 19, 2025
103443b
chore: remove closeSubscription field from StreamHookError and update…
alepane21 Aug 20, 2025
384d027
chore: update to new engine
alepane21 Aug 20, 2025
8177f80
chore: update engine
alepane21 Aug 21, 2025
0614486
chore: update graphql-go-tools dependency to latest version
alepane21 Aug 21, 2025
f3c67c7
chore: update graphql-go-tools dependency to new release version
alepane21 Aug 21, 2025
4a8bcbd
chore: update router and graphql-go-tools dependencies to latest vers…
alepane21 Aug 21, 2025
aa67e6d
chore: make the SubscriptionOnStartHookContext more restricted
alepane21 Aug 22, 2025
5caae33
chore: fix compile issues
StarpTech Aug 23, 2025
0756819
chore: remove test module
alepane21 Aug 25, 2025
3ac47c4
chore: restore Authentication on SubscriptionOnStart context
alepane21 Aug 25, 2025
665269e
chore: update graphql-go-tools dependency to new release version
alepane21 Aug 25, 2025
806a9cf
chore: update graphql-go-tools dependency to latest release version
alepane21 Aug 25, 2025
31d35e9
chore: update graphql-go-tools dependency to new release version
alepane21 Aug 25, 2025
ba23381
chore: update router and graphql-go-tools dependencies to latest vers…
alepane21 Aug 25, 2025
4a4fdd0
chore: upgrade engine
alepane21 Sep 3, 2025
14b5007
chore: upgrade deps
alepane21 Sep 3, 2025
d046fcd
chore: tidy modules
alepane21 Sep 3, 2025
bd4263a
chore: updage engine
alepane21 Sep 3, 2025
02e79be
chore: update router and graphql-go-tools dependencies to latest vers…
alepane21 Sep 3, 2025
7f93003
chore: go mod tidy
alepane21 Sep 3, 2025
90dba99
chore: update graphql-go-tools dependency to latest version
alepane21 Sep 9, 2025
e0583e8
chore: update router and graphql-go-tools dependencies to latest vers…
alepane21 Sep 9, 2025
564837a
chore: go mod tidy
alepane21 Sep 15, 2025
2af75cb
chore: update ADR to reflect implementation of SubscriptionOnStart
alepane21 Sep 16, 2025
af3bb30
Merge branch 'topic/streams-v1' into ale/eng-7600-add-subscriptionons…
dkorittki Sep 30, 2025
57bb4d9
chore: go mod tidy
dkorittki Oct 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
408 changes: 408 additions & 0 deletions adr/cosmo-streams-v1.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions demo/pkg/subgraphs/availability/subgraph/schema.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions demo/pkg/subgraphs/mood/subgraph/schema.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,079 changes: 1,079 additions & 0 deletions rfc/cosmo-streams-v1.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions router-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/wundergraph/cosmo/demo/pkg/subgraphs/projects v0.0.0-20250715110703-10f2e5f9c79e
github.com/wundergraph/cosmo/router v0.0.0-20250912064154-106e871ee32e
github.com/wundergraph/cosmo/router-plugin v0.0.0-20250808194725-de123ba1c65e
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.229
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.229.0.20250930144208-ddc652f78bbb
go.opentelemetry.io/otel v1.36.0
go.opentelemetry.io/otel/sdk v1.36.0
go.opentelemetry.io/otel/sdk/metric v1.36.0
Expand Down Expand Up @@ -209,7 +209,7 @@ replace (
github.com/wundergraph/cosmo/demo/pkg/subgraphs/projects => ../demo/pkg/subgraphs/projects
github.com/wundergraph/cosmo/router => ../router
github.com/wundergraph/cosmo/router-plugin => ../router-plugin
// github.com/wundergraph/graphql-go-tools/v2 => ../../graphql-go-tools/v2
//github.com/wundergraph/graphql-go-tools/v2 => ../../graphql-go-tools/v2
)

replace github.com/hashicorp/consul/sdk => github.com/wundergraph/consul/sdk v0.0.0-20250204115147-ed842a8fd301
2 changes: 2 additions & 0 deletions router-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ github.com/wundergraph/consul/sdk v0.0.0-20250204115147-ed842a8fd301 h1:EzfKHQoT
github.com/wundergraph/consul/sdk v0.0.0-20250204115147-ed842a8fd301/go.mod h1:wxI0Nak5dI5RvJuzGyiEK4nZj0O9X+Aw6U0tC1wPKq0=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.229 h1:VCfCX/xmpBGQLhTHJMHLugzJrXJk/smjLRAEruCI0HY=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.229/go.mod h1:g1IFIylu5Fd9pKjzq0mDvpaKhEB/vkwLAIbGdX2djXU=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.229.0.20250930144208-ddc652f78bbb h1:stBTAle5FyytsTNxYeCwNzYlyhKzlS4he6f7/y6O3qE=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.229.0.20250930144208-ddc652f78bbb/go.mod h1:g1IFIylu5Fd9pKjzq0mDvpaKhEB/vkwLAIbGdX2djXU=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4=
Expand Down
61 changes: 61 additions & 0 deletions router-tests/modules/start-subscription/module.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package start_subscription

import (
"net/http"

"go.uber.org/zap"

"github.com/wundergraph/cosmo/router/core"
)

const myModuleID = "startSubscriptionModule"

type StartSubscriptionModule struct {
Logger *zap.Logger
Callback func(ctx core.SubscriptionOnStartHookContext) error
CallbackOnOriginResponse func(response *http.Response, ctx core.RequestContext) *http.Response
}

func (m *StartSubscriptionModule) Provision(ctx *core.ModuleContext) error {
// Assign the logger to the module for non-request related logging
m.Logger = ctx.Logger

return nil
}

func (m *StartSubscriptionModule) SubscriptionOnStart(ctx core.SubscriptionOnStartHookContext) error {

m.Logger.Info("SubscriptionOnStart Hook has been run")

if m.Callback != nil {
return m.Callback(ctx)
}

return nil
}

func (m *StartSubscriptionModule) OnOriginResponse(response *http.Response, ctx core.RequestContext) *http.Response {
if m.CallbackOnOriginResponse != nil {
return m.CallbackOnOriginResponse(response, ctx)
}

return response
}

func (m *StartSubscriptionModule) Module() core.ModuleInfo {
return core.ModuleInfo{
// This is the ID of your module, it must be unique
ID: myModuleID,
// The priority of your module, lower numbers are executed first
Priority: 1,
New: func() core.Module {
return &StartSubscriptionModule{}
},
}
}

// Interface guard
var (
_ core.SubscriptionOnStartHandler = (*StartSubscriptionModule)(nil)
_ core.EnginePostOriginHandler = (*StartSubscriptionModule)(nil)
)
Loading