A Cosmo Streams Custom Module that lets you modify the subscription event configuration before the subscription is registered
SubscriptionOnCreate is an experimental hook. Its signature and behaviour may change without prior notice.
The SubscriptionOnCreate handler is a custom module hook that runs once per subscription, before the subscription is registered with the message broker. It gives you access to the subscription event configuration and lets you modify it in place.This handler is useful for:
Dynamic subject routing: Override NATS subjects, Redis channels or Kafka topics based on custom logic
Per-request configuration: Override provider-level defaults for individual subscriptions
Implement SubscriptionOnCreateHandler in a Custom Module to use this hook.
type SubscriptionOnCreateHandler interface { // SubscriptionOnCreate is called once before the subscription is registered. // Mutations to the SubscriptionEventConfiguration take effect immediately. // Returning a non-nil error aborts the subscription. // // This method is currently EXPERIMENTAL. // The signature and behaviour might change without prior notice. SubscriptionOnCreate(ctx SubscriptionOnCreateHandlerContext) error}type SubscriptionOnCreateHandlerContext interface { // Request is the original request received by the router. Request() *http.Request // Logger is the logger for the request. Logger() *zap.Logger // Operation is the GraphQL operation. Operation() OperationContext // Authentication is the authentication for the request. Authentication() authentication.Authentication // SubscriptionEventConfiguration returns the current subscription event configuration. // The returned value is a pointer; mutating it directly takes effect without any additional call. // // This method is currently EXPERIMENTAL. // The signature and behaviour might change without prior notice. SubscriptionEventConfiguration() datasource.SubscriptionEventConfiguration}
SubscriptionEventConfiguration is an interface. To access provider-specific fields you must type-assert to the concrete configuration type for your message broker.For NATS subscriptions:
import natspubsub "github.com/wundergraph/cosmo/router/pkg/pubsub/nats"func (m *MyModule) SubscriptionOnCreate(ctx core.SubscriptionOnCreateHandlerContext) error { cfg, ok := ctx.SubscriptionEventConfiguration().(*natspubsub.SubscriptionEventConfiguration) if !ok { return nil } // cfg.Subjects and cfg.StreamConfiguration are now directly mutable. return nil}
For Redis subscriptions:
import redispubsub "github.com/wundergraph/cosmo/router/pkg/pubsub/redis"func (m *MyModule) SubscriptionOnCreate(ctx core.SubscriptionOnCreateHandlerContext) error { cfg, ok := ctx.SubscriptionEventConfiguration().(*redispubsub.SubscriptionEventConfiguration) if !ok { return nil } // cfg fields are now directly mutable. return nil}
Use ctx.SubscriptionEventConfiguration().ProviderType() to branch by provider type when your module handles multiple providers.
The following example rewrites NATS subjects based on a tenant identifier from the request header. Each tenant is isolated to its own subject namespace.
package moduleimport ( "fmt" "github.com/wundergraph/cosmo/router/core" natspubsub "github.com/wundergraph/cosmo/router/pkg/pubsub/nats")func init() { core.RegisterModule(&TenantRoutingModule{})}const ModuleID = "tenantRoutingModule"type TenantRoutingModule struct{}func (m *TenantRoutingModule) SubscriptionOnCreate(ctx core.SubscriptionOnCreateHandlerContext) error { // Only rewrite subjects for the "employeeUpdated" subscription. if ctx.SubscriptionEventConfiguration().RootFieldName() != "employeeUpdated" { return nil } cfg, ok := ctx.SubscriptionEventConfiguration().(*natspubsub.SubscriptionEventConfiguration) if !ok { return nil } tenantID := ctx.Request().Header.Get("X-Tenant-ID") if tenantID == "" { return nil } // Prefix every subject with the tenant ID. for i, subject := range cfg.Subjects { cfg.Subjects[i] = fmt.Sprintf("%s.%s", tenantID, subject) } return nil}func (m *TenantRoutingModule) Module() core.ModuleInfo { return core.ModuleInfo{ ID: ModuleID, New: func() core.Module { return &TenantRoutingModule{} }, }}var _ core.SubscriptionOnCreateHandler = (*TenantRoutingModule)(nil)
The following example rewrites Redis channels based on a user ID extracted from the authenticated request. Each user receives events only from their own channel.
package moduleimport ( "fmt" "github.com/wundergraph/cosmo/router/core" redispubsub "github.com/wundergraph/cosmo/router/pkg/pubsub/redis")func init() { core.RegisterModule(&UserChannelRoutingModule{})}const ModuleID = "userChannelRoutingModule"type UserChannelRoutingModule struct{}func (m *UserChannelRoutingModule) SubscriptionOnCreate(ctx core.SubscriptionOnCreateHandlerContext) error { // Only rewrite channels for the "orderStatusUpdated" subscription. if ctx.SubscriptionEventConfiguration().RootFieldName() != "orderStatusUpdated" { return nil } cfg, ok := ctx.SubscriptionEventConfiguration().(*redispubsub.SubscriptionEventConfiguration) if !ok { return nil } auth := ctx.Authentication() if auth == nil { return nil } userID, ok := auth.Claims()["sub"].(string) if !ok || userID == "" { return nil } // Route each user to their own channel. for i, channel := range cfg.Channels { cfg.Channels[i] = fmt.Sprintf("%s.%s", channel, userID) } return nil}func (m *UserChannelRoutingModule) Module() core.ModuleInfo { return core.ModuleInfo{ ID: ModuleID, New: func() core.Module { return &UserChannelRoutingModule{} }, }}var _ core.SubscriptionOnCreateHandler = (*UserChannelRoutingModule)(nil)
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"WunderGraph","colors":{"primary":"#ea4899","light":"#ea4899","dark":"#ea4899"},"logo":{"light":"https://mintcdn.com/wundergraphinc/Lko791L3Kvuj3JHY/logo/light.svg?fit=max\u0026auto=format\u0026n=Lko791L3Kvuj3JHY\u0026q=85\u0026s=1877cdae169b31d438adf776ae7087f9","dark":"https://mintcdn.com/wundergraphinc/YDoaRPXJqqOa7ihg/logo/dark.svg?fit=max\u0026auto=format\u0026n=YDoaRPXJqqOa7ihg\u0026q=85\u0026s=2b2590e1246dbcde54be6f257ddc7885","href":"https://cosmo-docs.wundergraph.com/"},"favicon":"https://mintcdn.com/wundergraphinc/urh2bRDxnny5gbfk/favicon.png?fit=max\u0026auto=format\u0026n=urh2bRDxnny5gbfk\u0026q=85\u0026s=5c8f87531fa87214946d81c914c93efc","appearance":{"default":"dark"},"background":{"decoration":"windows"},"navbar":{"links":[{"href":"https://cosmo.wundergraph.com/login","label":"Cloud Login"}],"primary":{"type":"button","label":"Talk to an Expert","href":"https://wundergraph.com/contact/sales"}},"footer":{"socials":{"x":"https://twitter.com/wundergraphcom","discord":"https://wundergraph.com/discord","github":"https://github.com/wundergraph","youtube":"https://www.youtube.com/@wundergraph"},"links":[{"header":"Legal","items":[{"label":"Privacy Policy","href":"https://wundergraph.com/privacy-policy"},{"label":"Cookie Policy","href":"https://wundergraph.com/cookies"},{"label":"Website Terms","href":"https://wundergraph.com/terms"},{"label":"Cosmo Managed Terms","href":"https://wundergraph.com/cosmo-managed-service-terms"}]},{"header":"Trust","items":[{"label":"Trust Center","href":"https://trust.wundergraph.com/"}]}]},"fonts":{"heading":{"family":"Inter"},"body":{"family":"Inter"}},"styling":{"eyebrows":"breadcrumbs","codeblocks":"system","latex":false},"integrations":{"gtm":{"tagId":"GTM-5GPL7DQH"},"koala":{"publicApiKey":"pk_c7477bfbf86479d918562f7add220a2d7098"},"posthog":{"apiKey":"phc_CEnvoyw3KcTuC5E1seDPrgvAamgGRDLfzPi1e7RU1G1","apiHost":"https://eu.i.posthog.com"},"plausible":{"domain":"cosmo-docs.wundergraph.com"}},"banner":{"content":"Help map how teams scale Federated GraphQL in the State of Federation 2026 Survey. We donate $30 to UNICEF per response → [Take the survey](https://8bxwlo3ot55.typeform.com/to/zIJKRQUe).","dismissible":false},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"navigation":{"global":{"anchors":[{"anchor":"Platform Status","icon":"signal","href":"https://status.wundergraph.com/"},{"anchor":"GitHub","icon":"github","href":"https://github.com/wundergraph/cosmo"},{"anchor":"Blog","icon":"newspaper","href":"https://wundergraph.com/blog"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"wundergraphinc","hasAudioNarration":false,"actualSubdomain":"wundergraphinc","customDomains":["cosmo-docs.wundergraph.com"],"gitSource":{"type":"github","owner":"wundergraph","repo":"cosmo","deployBranch":"main","contentDirectory":"docs-website","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae1cf52372d045ef83e6e38","collectionId":"b28fa0be-6b11-4265-85ed-a698ee69dde7","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae1cf52372d045ef83e6e38"},"feedback":{"thumbs":true,"edits":false,"issues":false},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"DISABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae1cf52372d045ef83e6e38","clientVersion":"0.0.4044","searchFilterCounts":[{"language":"default","tag":"Documentation","count":220},{"language":"default","tag":"CLI","count":214},{"language":"default","tag":"Router","count":124},{"language":"default","tag":"Studio","count":56},{"language":"default","tag":"Tutorials","count":26},{"language":"default","tag":"GraphQL / Federation","count":24},{"language":"default","tag":"Directives","count":17},{"language":"default","tag":"Cosmo Connect","count":15},{"language":"default","tag":"Monograph","count":14},{"language":"default","tag":"Subgraph","count":14}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":".osano-cm-dialog--type_box{border-radius:.375rem}.osano-cm-dialog--type_box,.osano-cm-info{--box-shadow:0 10px 15px -3px rgb(248 248 251 / 0.3),\n 0 4px 6px -4px rgb(248 248 251 / 0.3);-webkit-box-shadow:var(--box-shadow);-moz-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow)}.osano-cm-widget:focus{outline:0}"}],"page":{"pagePath":"router/cosmo-streams/custom-modules/subscription-on-create","slug":"/router/cosmo-streams/custom-modules/subscription-on-create","pageMetadata":{"title":"SubscriptionOnCreate Handler","description":"A Cosmo Streams Custom Module that lets you modify the subscription event configuration before the subscription is registered","icon":"circle-plus","href":"/router/cosmo-streams/custom-modules/subscription-on-create"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"A Cosmo Streams Custom Module that lets you modify the subscription event configuration before the subscription is registered\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`SubscriptionOnCreate`}),` is an experimental hook. Its signature and behaviour may change without prior notice.`]})}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`SubscriptionOnCreate`}),` handler is a custom module hook that runs once per subscription, before the subscription is registered with the message broker. It gives you access to the subscription event configuration and lets you modify it in place.`]}),`\n`,_jsx(_components.p,{children:`This handler is useful for:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Dynamic subject routing`}),`: Override NATS subjects, Redis channels or Kafka topics based on custom logic`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Per-request configuration`}),`: Override provider-level defaults for individual subscriptions`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`limitations`,children:`Limitations`}),`\n`,_jsxs(_components.p,{children:[`Compared to `,_jsx(_components.a,{href:`/router/cosmo-streams/custom-modules/subscription-on-start`,children:_jsx(_components.code,{children:`SubscriptionOnStart`})}),`, this handler:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Cannot emit events to the client`}),`\n`,_jsx(_components.li,{children:`Only applies to Cosmo Streams / EDFS subscriptions, not to regular GraphQL subscriptions`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`handler-interface`,children:`Handler Interface`}),`\n`,_jsxs(_components.p,{children:[`Implement `,_jsx(_components.code,{children:`SubscriptionOnCreateHandler`}),` in a `,_jsx(_components.a,{href:`/router/custom-modules`,children:`Custom Module`}),` to use this hook.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`26`,language:`go`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`go`,children:_jsxs(_components.code,{language:`go`,numberOfLines:`26`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` SubscriptionOnCreateHandler`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` interface`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // SubscriptionOnCreate is called once before the subscription is registered.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Mutations to the SubscriptionEventConfiguration take effect immediately.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Returning a non-nil error aborts the subscription.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` //`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // This method is currently EXPERIMENTAL.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // The signature and behaviour might change without prior notice.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` SubscriptionOnCreate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` SubscriptionOnCreateHandlerContext`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#4EC9B0`},children:`error`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` SubscriptionOnCreateHandlerContext`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` interface`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Request is the original request received by the router.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`http`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`Request`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Logger is the logger for the request.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Logger`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`zap`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`Logger`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Operation is the GraphQL operation.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Operation`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`OperationContext`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Authentication is the authentication for the request.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Authentication`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`authentication`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`Authentication`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // SubscriptionEventConfiguration returns the current subscription event configuration.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // The returned value is a pointer; mutating it directly takes effect without any additional call.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` //`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // This method is currently EXPERIMENTAL.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // The signature and behaviour might change without prior notice.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` SubscriptionEventConfiguration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`datasource`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`SubscriptionEventConfiguration`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`modifying-the-configuration`,children:`Modifying the Configuration`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`SubscriptionEventConfiguration`}),` is an interface. To access provider-specific fields you must type-assert to the concrete configuration type for your message broker.`]}),`\n`,_jsx(_components.p,{children:`For NATS subscriptions:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`go`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`go`,children:_jsxs(_components.code,{language:`go`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` natspubsub`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#CE9178`},children:`github.com/wundergraph/cosmo/router/pkg/pubsub/nats`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`func`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`m `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`MyModule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`SubscriptionOnCreate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` core`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`SubscriptionOnCreateHandlerContext`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#4EC9B0`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cfg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ok`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`SubscriptionEventConfiguration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`natspubsub`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`SubscriptionEventConfiguration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ok`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // cfg.Subjects and cfg.StreamConfiguration are now directly mutable.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`For Redis subscriptions:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`go`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`go`,children:_jsxs(_components.code,{language:`go`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` redispubsub`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#CE9178`},children:`github.com/wundergraph/cosmo/router/pkg/pubsub/redis`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`func`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`m `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`MyModule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`SubscriptionOnCreate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` core`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`SubscriptionOnCreateHandlerContext`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#4EC9B0`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cfg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ok`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`SubscriptionEventConfiguration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`redispubsub`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`SubscriptionEventConfiguration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ok`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // cfg fields are now directly mutable.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Use `,_jsx(_components.code,{children:`ctx.SubscriptionEventConfiguration().ProviderType()`}),` to branch by provider type when your module handles multiple providers.`]}),`\n`,_jsx(Heading,{level:`2`,id:`usage-example`,children:`Usage Example`}),`\n`,_jsx(Heading,{level:`3`,id:`dynamic-nats-subject-routing`,children:`Dynamic NATS subject routing`}),`\n`,_jsx(_components.p,{children:`The following example rewrites NATS subjects based on a tenant identifier from the request header. Each tenant is isolated to its own subject namespace.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`50`,language:`go`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`go`,children:_jsxs(_components.code,{language:`go`,numberOfLines:`50`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`package`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` module`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#CE9178`},children:`fmt`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#CE9178`},children:`github.com/wundergraph/cosmo/router/core`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` natspubsub`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#CE9178`},children:`github.com/wundergraph/cosmo/router/pkg/pubsub/nats`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`func`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` init`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` core`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`RegisterModule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u0026`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`TenantRoutingModule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{})`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` ModuleID`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"tenantRoutingModule\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` TenantRoutingModule`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` struct`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`func`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`m `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`TenantRoutingModule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`SubscriptionOnCreate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` core`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`SubscriptionOnCreateHandlerContext`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#4EC9B0`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Only rewrite subjects for the \"employeeUpdated\" subscription.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`SubscriptionEventConfiguration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`RootFieldName`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"employeeUpdated\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cfg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ok`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`SubscriptionEventConfiguration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`natspubsub`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`SubscriptionEventConfiguration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ok`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` tenantID`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Header`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"X-Tenant-ID\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` tenantID`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Prefix every subject with the tenant ID.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` i`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`subject`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` range`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cfg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Subjects`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cfg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Subjects`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`i`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` fmt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Sprintf`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#9CDCFE`},children:`%s`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#9CDCFE`},children:`%s`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`tenantID`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`subject`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`func`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`m `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`TenantRoutingModule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Module`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`core`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`ModuleInfo`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` core`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`ModuleInfo`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ID`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ModuleID`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` New`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`func`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`core`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`Module`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`TenantRoutingModule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`var`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` _`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` core`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`SubscriptionOnCreateHandler`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`TenantRoutingModule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`nil`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`dynamic-redis-channel-routing`,children:`Dynamic Redis channel routing`}),`\n`,_jsx(_components.p,{children:`The following example rewrites Redis channels based on a user ID extracted from the authenticated request. Each user receives events only from their own channel.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`55`,language:`go`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`go`,children:_jsxs(_components.code,{language:`go`,numberOfLines:`55`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`package`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` module`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#CE9178`},children:`fmt`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#CE9178`},children:`github.com/wundergraph/cosmo/router/core`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` redispubsub`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#CE9178`},children:`github.com/wundergraph/cosmo/router/pkg/pubsub/redis`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`func`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` init`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` core`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`RegisterModule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u0026`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`UserChannelRoutingModule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{})`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` ModuleID`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"userChannelRoutingModule\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` UserChannelRoutingModule`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` struct`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`func`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`m `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`UserChannelRoutingModule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`SubscriptionOnCreate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` core`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`SubscriptionOnCreateHandlerContext`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#4EC9B0`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Only rewrite channels for the \"orderStatusUpdated\" subscription.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`SubscriptionEventConfiguration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`RootFieldName`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"orderStatusUpdated\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cfg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ok`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`SubscriptionEventConfiguration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`redispubsub`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`SubscriptionEventConfiguration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ok`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` auth`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Authentication`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` auth`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ==`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` userID`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ok`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` auth`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Claims`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sub\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#4EC9B0`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ok`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ||`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` userID`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Route each user to their own channel.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` i`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`channel`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` range`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cfg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Channels`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cfg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Channels`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`i`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` fmt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Sprintf`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#9CDCFE`},children:`%s`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#9CDCFE`},children:`%s`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`channel`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`userID`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`func`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`m `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`UserChannelRoutingModule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Module`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`core`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`ModuleInfo`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` core`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`ModuleInfo`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ID`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ModuleID`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` New`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`func`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`core`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`Module`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`UserChannelRoutingModule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`var`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` _`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` core`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`SubscriptionOnCreateHandler`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`UserChannelRoutingModule`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`nil`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":"system","config":{},"pageMetadata":{"title":"SubscriptionOnCreate Handler","description":"A Cosmo Streams Custom Module that lets you modify the subscription event configuration before the subscription is registered","icon":"circle-plus","href":"/router/cosmo-streams/custom-modules/subscription-on-create"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Limitations","slug":"limitations","depth":2,"children":[]},{"title":"Handler Interface","slug":"handler-interface","depth":2,"children":[]},{"title":"Modifying the Configuration","slug":"modifying-the-configuration","depth":2,"children":[]},{"title":"Usage Example","slug":"usage-example","depth":2,"children":[{"title":"Dynamic NATS subject routing","slug":"dynamic-nats-subject-routing","depth":3,"children":[]},{"title":"Dynamic Redis channel routing","slug":"dynamic-redis-channel-routing","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/wundergraphinc/c20d56ed2ea5ad45/analytics.js","/_mintlify/custom/wundergraphinc/0a55a31d9c045e90/osano.js"],"subdomain":"wundergraphinc","siteName":"WunderGraph","title":"SubscriptionOnCreate Handler - WunderGraph","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-07-02T16:35:13.634Z","originalFileLocation":"router/cosmo-streams/custom-modules/subscription-on-create.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"A Cosmo Streams Custom Module that lets you modify the subscription event configuration before the subscription is registered\">\u003cmeta data-mint-head name=\"application-name\" content=\"WunderGraph\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/wundergraphinc/lz2f-9ge_mXpMLAt/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/wundergraphinc/lz2f-9ge_mXpMLAt/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/wundergraphinc/lz2f-9ge_mXpMLAt/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/wundergraphinc/lz2f-9ge_mXpMLAt/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/wundergraphinc/lz2f-9ge_mXpMLAt/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/wundergraphinc/lz2f-9ge_mXpMLAt/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/wundergraphinc/lz2f-9ge_mXpMLAt/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/wundergraphinc/lz2f-9ge_mXpMLAt/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/wundergraphinc/lz2f-9ge_mXpMLAt/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"SubscriptionOnCreate Handler - WunderGraph\">\u003cmeta data-mint-head property=\"og:description\" content=\"A Cosmo Streams Custom Module that lets you modify the subscription event configuration before the subscription is registered\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"WunderGraph\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://cosmo-docs.wundergraph.com/router/cosmo-streams/custom-modules/subscription-on-create\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://wundergraphinc.mintlify.app/_mintlify/api/og/v2?division=Custom+Modules\u0026amp;title=SubscriptionOnCreate+Handler\u0026amp;description=A+Cosmo+Streams+Custom+Module+that+lets+you+modify+the+subscription+event+configuration+before+the+subscription+is+registered\u0026amp;theme=bec8a9a9f4ab1a77bed38caa\u0026amp;signature=8bc9e31797f9b6329e48a937b742ce99c338942d58dc5896bd9473666ed9f08f\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"SubscriptionOnCreate Handler - WunderGraph\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"A Cosmo Streams Custom Module that lets you modify the subscription event configuration before the subscription is registered\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://wundergraphinc.mintlify.app/_mintlify/api/og/v2?division=Custom+Modules\u0026amp;title=SubscriptionOnCreate+Handler\u0026amp;description=A+Cosmo+Streams+Custom+Module+that+lets+you+modify+the+subscription+event+configuration+before+the+subscription+is+registered\u0026amp;theme=bec8a9a9f4ab1a77bed38caa\u0026amp;signature=8bc9e31797f9b6329e48a937b742ce99c338942d58dc5896bd9473666ed9f08f\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/wundergraphinc/lz2f-9ge_mXpMLAt/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"WunderGraph\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#ea4899\">\u003clink data-mint-head rel=\"canonical\" href=\"https://cosmo-docs.wundergraph.com/router/cosmo-streams/custom-modules/subscription-on-create\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/router/cosmo-streams/custom-modules/subscription-on-create.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://cosmo-docs.wundergraph.com/#organization\",\"name\":\"WunderGraph\",\"url\":\"https://cosmo-docs.wundergraph.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/wundergraphinc/Lko791L3Kvuj3JHY/logo/light.svg?fit=max\u0026auto=format\u0026n=Lko791L3Kvuj3JHY\u0026q=85\u0026s=1877cdae169b31d438adf776ae7087f9\"}},{\"@type\":\"WebSite\",\"@id\":\"https://cosmo-docs.wundergraph.com#website\",\"name\":\"WunderGraph\",\"url\":\"https://cosmo-docs.wundergraph.com\",\"publisher\":{\"@id\":\"https://cosmo-docs.wundergraph.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://cosmo-docs.wundergraph.com/router/cosmo-streams/custom-modules/subscription-on-create#webpage\",\"url\":\"https://cosmo-docs.wundergraph.com/router/cosmo-streams/custom-modules/subscription-on-create\",\"name\":\"SubscriptionOnCreate Handler\",\"description\":\"A Cosmo Streams Custom Module that lets you modify the subscription event configuration before the subscription is registered\",\"dateModified\":\"2026-07-02T16:35:13.634Z\",\"isPartOf\":{\"@id\":\"https://cosmo-docs.wundergraph.com#website\"},\"breadcrumb\":{\"@id\":\"https://cosmo-docs.wundergraph.com/router/cosmo-streams/custom-modules/subscription-on-create#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://cosmo-docs.wundergraph.com/router/cosmo-streams/custom-modules/subscription-on-create#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Router\",\"item\":\"https://cosmo-docs.wundergraph.com/router/intro\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cosmo Streams (EDFS)\",\"item\":\"https://cosmo-docs.wundergraph.com/router/cosmo-streams\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Custom Modules\",\"item\":\"https://cosmo-docs.wundergraph.com/router/cosmo-streams/custom-modules\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"SubscriptionOnCreate Handler\",\"item\":\"https://cosmo-docs.wundergraph.com/router/cosmo-streams/custom-modules/subscription-on-create\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://cosmo-docs.wundergraph.com/router/cosmo-streams/custom-modules/subscription-on-create#article\",\"headline\":\"SubscriptionOnCreate Handler\",\"name\":\"SubscriptionOnCreate Handler\",\"description\":\"A Cosmo Streams Custom Module that lets you modify the subscription event configuration before the subscription is registered\",\"url\":\"https://cosmo-docs.wundergraph.com/router/cosmo-streams/custom-modules/subscription-on-create\",\"mainEntityOfPage\":{\"@id\":\"https://cosmo-docs.wundergraph.com/router/cosmo-streams/custom-modules/subscription-on-create#webpage\"},\"dateModified\":\"2026-07-02T16:35:13.634Z\",\"publisher\":{\"@id\":\"https://cosmo-docs.wundergraph.com/#organization\"},\"isPartOf\":{\"@id\":\"https://cosmo-docs.wundergraph.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"WunderGraph\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"WunderGraph","nav":{"global":{"anchors":[{"anchor":"Platform Status","icon":"signal","href":"https://status.wundergraph.com/"},{"anchor":"GitHub","icon":"github","href":"https://github.com/wundergraph/cosmo"},{"anchor":"Blog","icon":"newspaper","href":"https://wundergraph.com/blog"}]},"tabs":[{"tab":"Documentation","icon":"book-open","groups":[{"group":" ","pages":[{"title":"WunderGraph Cosmo","icon":"note","href":"/overview"},{"title":"Architecture","icon":"archway","href":"/architecture"},{"title":"Enterprise","icon":"building-memo","href":"/enterprise"},{"title":"Security \u0026 Compliance","icon":"lock","href":"/security-and-compliance"},{"title":"Self Hosting","icon":"note","href":"/self-hosted"}]},{"group":"Getting Started","pages":[{"title":"Cosmo Cloud Onboarding","icon":"cloud-sun","href":"/getting-started/cosmo-cloud-onboarding"},{"title":"Switch from Apollo to Cosmo","icon":"rotate","href":"/getting-started/switch-from-apollo-to-cosmo"},{"title":"Mastering Local Development for GraphQL Federation","icon":"code","href":"/tutorial/mastering-local-development-for-graphql-federation"}]},{"group":"Concepts","pages":[{"title":"Proposals","icon":"file-circle-plus","href":"/concepts/proposals"},{"title":"Feature Flags","icon":"flag","href":"/concepts/feature-flags"},{"title":"Namespaces","icon":"object-ungroup","href":"/concepts/namespaces"},{"title":"Schema Contracts","icon":"file-signature","href":"/concepts/schema-contracts"},{"title":"Cache Warmer","icon":"fire","href":"/concepts/cache-warmer"},{"title":"Router Compatibility Versions","icon":"handshake","href":"/concepts/router-compatibility-versions"}]},{"group":"Cosmo Connect","pages":[{"title":"Overview","icon":"circle-info","href":"/connect/overview"},{"title":"Router Plugins","icon":"plug","href":"/connect/plugins"},{"title":"gRPC Services","icon":"server","href":"/connect/grpc-services"}]},{"group":"Cosmo ConnectRPC","pages":[{"title":"Overview","icon":"circle-info","href":"/connect-rpc/overview"},{"title":"Define Contracts","icon":"scroll","href":"/connect-rpc/produce-define-contracts"},{"title":"Configure Router","icon":"gears","href":"/connect-rpc/produce-configure-router"},{"title":"Generate \u0026 Distribute SDKs","icon":"wand-magic-sparkles","href":"/connect-rpc/produce-generate-distribute-sdks"},{"title":"Consume SDKs","icon":"brackets-curly","href":"/connect-rpc/consume-via-sdks"},{"title":"Consume REST / OpenAPI","icon":"arrow-right-arrow-left","href":"/connect-rpc/consume-via-rest-openapi"},{"title":"Consume gRPC","icon":"tower-broadcast","href":"/connect-rpc/consume-via-grpc"}]},{"group":"Router","pages":[{"title":"Cosmo Router","icon":"door-open","href":"/router/intro"},{"title":"Download \u0026 Install","icon":"sign-posts-wrench","href":"/router/download-and-install"},{"group":"Configuration","icon":"sliders-up","pages":[{"title":"Router Configuration","icon":"circle-info","sidebarTitle":"Overview","href":"/router/configuration"},{"title":"Configuration Design","icon":"ruler-combined","href":"/router/configuration/config-design"},{"title":"Template Expressions","icon":"brackets-curly","href":"/router/configuration/template-expressions"}]},{"group":"MCP Gateway","icon":"robot","pages":[{"title":"MCP Gateway","icon":"robot","href":"/router/mcp"},{"title":"Quickstart","icon":"rocket","href":"/router/mcp/quickstart"},{"title":"Tools","icon":"wrench","href":"/router/mcp/tools"},{"title":"Configuration","icon":"sliders-up","href":"/router/mcp/configuration"},{"group":"OAuth 2.1","icon":"shield-check","pages":[{"title":"Overview","icon":"shield-check","href":"/router/mcp/oauth/overview"},{"title":"OAuth Quickstart","icon":"rocket","href":"/router/mcp/oauth/quickstart"},{"title":"Scope Enforcement","icon":"layer-group","href":"/router/mcp/oauth/scopes"},{"title":"OAuth Configuration Reference","icon":"sliders-up","href":"/router/mcp/oauth/configuration"}]},{"title":"IDE \u0026 AI Tool Setup","icon":"display-code","href":"/router/mcp/ide-setup"}]},{"group":"Custom Modules","icon":"cubes","pages":[{"title":"Overview","icon":"cubes","href":"/router/custom-modules"},{"title":"Migration: Request Deduplication","icon":"arrows-turn-right","href":"/router/custom-modules-migration"}]},{"group":"Cosmo Connect","icon":"network-wired","pages":[{"title":"Overview","icon":"lightbulb","sidebarTitle":"Overview","href":"/router/gRPC/concepts"},{"group":"Plugins","icon":"plug","pages":[{"title":"Plugins","sidebarTitle":"Overview","icon":"circle-info","href":"/router/gRPC/plugins"},{"title":"Debugging","sidebarTitle":"Debugging","icon":"bug","href":"/router/gRPC/plugins/debugging"},{"group":"Go Plugins","icon":"golang","pages":[{"title":"Go Plugins","icon":"circle-info","sidebarTitle":"Overview","href":"/router/gRPC/plugins/go-plugin/overview"},{"title":"HTTP Client","sidebarTitle":"HTTP Client","icon":"diagram-project","href":"/router/gRPC/plugins/go-plugin/http-client"},{"title":"Telemetry","sidebarTitle":"Telemetry","icon":"binary-circle-check","href":"/router/gRPC/plugins/go-plugin/telemetry"},{"title":"Logging","icon":"file-lines","href":"/router/gRPC/plugins/go-plugin/logging"}]},{"group":"TypeScript Plugins","icon":"t","pages":[{"title":"TypeScript Plugins","icon":"circle-info","sidebarTitle":"Overview","href":"/router/gRPC/plugins/ts-plugin/overview"}]}]},{"title":"gRPC Services","sidebarTitle":"gRPC Services","icon":"server","href":"/router/gRPC/grpc-services"},{"title":"GraphQL Support","icon":"shield-check","href":"/router/gRPC/graphql-support"},{"title":"Field Resolvers","sidebarTitle":"Field Resolvers","icon":"function","href":"/router/gRPC/field-resolvers"},{"title":"@requires","sidebarTitle":"@requires","icon":"link","href":"/router/gRPC/requires"}]},{"title":"Authentication \u0026 Authorization","icon":"camera-cctv","href":"/router/authentication-and-authorization"},{"title":"Advanced Data Privacy","icon":"fingerprint","href":"/router/advanced-data-privacy"},{"group":"Subscriptions","icon":"webhook","pages":[{"title":"Subscriptions","icon":"circle-info","sidebarTitle":"Overview","href":"/router/subscriptions"},{"title":"Server Sent Events (SSE)","icon":"server","href":"/router/subscriptions/server-sent-events-sse"},{"title":"Multipart HTTP Requests","icon":"network-wired","href":"/router/subscriptions/multipart-http-requests"},{"title":"Websocket Subprotocols","icon":"plug","href":"/router/subscriptions/websocket-subprotocols"},{"title":"Subscriptions Configuration","icon":"router","sidebarTitle":"Configuration","href":"/router/subscriptions/router-configuration-for-subscriptions"},{"title":"Migration: Subscriptions Overhaul","icon":"arrows-turn-right","href":"/router/subscriptions-migration"}]},{"group":"Defer","icon":"forward-step","pages":[{"title":"Defer","icon":"forward-step","sidebarTitle":"Overview","href":"/router/defer"},{"title":"Using @defer","icon":"code","sidebarTitle":"Usage and Examples","href":"/router/defer/usage"},{"title":"How the Router Executes @defer","icon":"diagram-project","sidebarTitle":"How It Works","href":"/router/defer/how-it-works"},{"title":"When to Use @defer","icon":"scale-balanced","sidebarTitle":"When to Use","href":"/router/defer/when-to-use"}]},{"group":"Persisted Queries","icon":"cloud-binary","pages":[{"title":"Persisted Queries","icon":"circle-info","sidebarTitle":"Overview","href":"/router/persisted-queries"},{"title":"Persisted Operations","icon":"database","href":"/router/persisted-queries/persisted-operations"},{"title":"Automatic Persisted Queries (APQ)","icon":"bolt","href":"/router/persisted-queries/automatic-persisted-queries-apq"}]},{"group":"Open Telemetry","icon":"binary-circle-check","pages":[{"title":"Open Telemetry","sidebarTitle":"Overview","icon":"circle-info","href":"/router/open-telemetry"},{"title":"Custom Attributes","icon":"globe","href":"/router/open-telemetry/custom-attributes"},{"title":"Prometheus OTLP Ingestion","icon":"gauge-high","href":"/router/open-telemetry/prometheus-otlp-ingestion"},{"title":"Setup OpenTelemetry Collector","icon":"server","href":"/router/open-telemetry/setup-opentelemetry-collector"},{"title":"Dynatrace","icon":"server","href":"/router/open-telemetry/dynatrace"}]},{"group":"Metrics \u0026 Monitoring","icon":"projector","pages":[{"title":"Metrics \u0026 Monitoring","sidebarTitle":"Overview","icon":"circle-info","href":"/router/metrics-and-monitoring"},{"title":"Span Error Status \u0026 Error Metrics","sidebarTitle":"Span Error Status","icon":"triangle-exclamation","href":"/router/metrics-and-monitoring/span-error-status"},{"title":"Exemplars","sidebarTitle":"Exemplars","icon":"crosshairs","href":"/router/metrics-and-monitoring/exemplars"},{"title":"Prometheus Metric Reference","icon":"gauge-high","href":"/router/metrics-and-monitoring/prometheus-metric-reference"},{"title":"Grafana","icon":"chart-line","href":"/router/metrics-and-monitoring/grafana"}]},{"group":"Proxy capabilities","icon":"bridge-circle-check","pages":[{"title":"Proxy Capabilities","icon":"circle-info","sidebarTitle":"Overview","href":"/router/proxy-capabilities"},{"title":"Subgraph Request Headers Operations","icon":"arrow-right-to-bracket","href":"/router/proxy-capabilities/subgraph-request-header-operations"},{"title":"Subgraph Response Header Operations","icon":"arrow-right-from-bracket","href":"/router/proxy-capabilities/subgraph-response-header-operations"},{"title":"Forward Client Extensions","icon":"share-nodes","href":"/router/proxy-capabilities/forward-client-extensions"},{"title":"Adjusting Cache Control","icon":"clock","href":"/router/proxy-capabilities/adjusting-cache-control"},{"title":"Override Subgraph Config","icon":"sliders","href":"/router/proxy-capabilities/override-subgraph-config"},{"title":"Router Response Header Operations","icon":"arrow-right-from-bracket","href":"/router/proxy-capabilities/router-response-header-operations"}]},{"group":"Traffic shaping","icon":"road-circle-check","pages":[{"title":"Traffic Shaping","icon":"circle-info","sidebarTitle":"Overview","href":"/router/traffic-shaping"},{"title":"Retry","icon":"arrow-rotate-left","href":"/router/traffic-shaping/retry"},{"title":"Timeout","icon":"clock","href":"/router/traffic-shaping/timeout"},{"title":"Circuit Breaker","icon":"plug-circle-bolt","href":"/router/traffic-shaping/circuit-breaker"}]},{"title":"Storage Providers","icon":"cabinet-filing","href":"/router/storage-providers"},{"group":"Deployment","icon":"truck-ramp-couch","pages":[{"title":"Deployment","sidebarTitle":"Overview","icon":"circle-info","href":"/router/deployment"},{"title":"Config Hot Reload","icon":"arrows-rotate","href":"/router/deployment/config-hot-reload"}]},{"group":"Security","icon":"shield-quartered","pages":[{"title":"Security","sidebarTitle":"Overview","icon":"circle-info","href":"/router/security"},{"title":"TLS","icon":"shield-halved","href":"/router/security/tls"},{"title":"Config Validation \u0026 Signing","icon":"signature","href":"/router/security/config-validation-and-signing"},{"title":"Hardening Guide","icon":"book","href":"/router/security/hardening-guide"},{"title":"Cost Control","icon":"scale-balanced","href":"/router/security/cost-control"},{"title":"Validate Inline Arguments","icon":"shield-halved","href":"/router/security/validate-inline-arguments"}]},{"group":"Development","icon":"flask-round-potion","pages":[{"title":"Development","icon":"circle-info","sidebarTitle":"Overview","href":"/router/development"},{"title":"Debugging","icon":"bug","href":"/router/development/debugging"},{"title":"Development Mode","icon":"code","href":"/router/development/development-mode"}]},{"title":"Response Cache (Experimental)","icon":"boxes-stacked","href":"/router/response-cache"},{"title":"Request Deduplication","icon":"clone","href":"/router/request-deduplication"},{"title":"Performance Debugging","icon":"gauge-high","href":"/router/performance-debugging"},{"title":"Advanced Request Tracing (ART)","icon":"stars","href":"/router/advanced-request-tracing-art"},{"group":"Query Plan","icon":"file-contract","pages":[{"title":"Query Plan","icon":"circle-info","sidebarTitle":"Overview","href":"/router/query-plan"},{"title":"Batch Generate Query Plans","icon":"layer-group","href":"/router/query-plan/batch-generate-query-plans"}]},{"group":"Cosmo Streams (EDFS)","icon":"wave","pages":[{"title":"Cosmo Streams (EDFS)","icon":"circle-info","sidebarTitle":"Overview","href":"/router/cosmo-streams"},{"group":"NATS","icon":"puzzle-piece","pages":[{"title":"NATS","sidebarTitle":"Overview","icon":"circle-info","href":"/router/cosmo-streams/nats"},{"title":"Stream And Consumer Configuration","icon":"wave","href":"/router/cosmo-streams/nats/stream-and-consumer-configuration"}]},{"title":"Kafka","icon":"sitemap","href":"/router/cosmo-streams/kafka"},{"title":"Redis","icon":"sitemap","href":"/router/cosmo-streams/redis"},{"group":"Custom Modules","icon":"cubes","pages":[{"title":"Custom Modules","sidebarTitle":"Overview","description":"Customize Streams behavior with powerful handlers for subscription lifecycle, event processing, and data transformation.","icon":"circle-info","href":"/router/cosmo-streams/custom-modules"},{"title":"SubscriptionOnCreate Handler","icon":"circle-plus","href":"/router/cosmo-streams/custom-modules/subscription-on-create"},{"title":"SubscriptionOnStart Handler","description":"A Cosmo Streams Custom Module, which lets you customize subscription initialization behavior","icon":"circle-play","href":"/router/cosmo-streams/custom-modules/subscription-on-start"},{"title":"BeforeEventsDispatch Handler","icon":"split","href":"/router/cosmo-streams/custom-modules/before-events-dispatch"},{"title":"OnReceiveEvents Handler","icon":"arrow-left","href":"/router/cosmo-streams/custom-modules/on-receive-event"},{"title":"OnPublishEvents Handler","icon":"arrow-right","href":"/router/cosmo-streams/custom-modules/on-publish-event"}]}]},{"title":"Compliance and Data Management","icon":"cloud-binary","href":"/router/compliance-and-data-management"},{"title":"Query Batching","icon":"layer-group","sidebarTitle":"Query Batching","href":"/router/query-batching"},{"title":"Feature Flags","icon":"flag","sidebarTitle":"Feature Flags","href":"/router/feature-flags"},{"group":"Subgraph data propagation","icon":"share-from-square","pages":[{"title":"Subgraph Error Propagation","icon":"bug","href":"/router/subgraph-data-propagation/subgraph-error-propagation"},{"title":"Subgraph Extension Propagation","icon":"puzzle-piece","href":"/router/subgraph-data-propagation/subgraph-extension-propagation"}]},{"title":"Relaxed Field Selection Merging Nullability","icon":"merge","href":"/router/relaxed-field-selection-merging-nullability"},{"title":"String Literals for Enums","icon":"quotes","href":"/router/string-literals-for-enums"},{"title":"File Upload","icon":"upload","href":"/router/file-upload"},{"title":"Access Logs","icon":"camera-cctv","href":"/router/access-logs"},{"title":"Profiling","icon":"binoculars","href":"/router/profiling"},{"title":"Upgrading The Router","icon":"arrows-rotate","href":"/router/upgrading-the-router"}]},{"group":"Studio","pages":[{"title":"Cosmo Studio","icon":"door-open","href":"/studio/intro"},{"title":"Overview Page","icon":"map","href":"/studio/overview-page"},{"title":"Schema Explorer","icon":"file-lines","href":"/studio/schema-explorer"},{"title":"Schema Registry","icon":"atom","href":"/studio/schema-registry"},{"title":"Schema Checks","icon":"list-check","href":"/studio/schema-checks"},{"group":"Check Extensions","icon":"puzzle-piece-simple","pages":[{"title":"Subgraph Check Extensions","sidebarTitle":"Overview","icon":"puzzle-piece-simple","href":"/studio/subgraph-check-extensions"},{"title":"Request Payload Structure","sidebarTitle":"Request Payload","icon":"share","href":"/studio/sce/request-payload-structure"},{"title":"Response Payload Structure","sidebarTitle":"Response Payload","icon":"reply","href":"/studio/sce/response-structure"},{"title":"File Structure","sidebarTitle":"File Structure","icon":"file-export","href":"/studio/sce/file-content"},{"title":"Handler example","sidebarTitle":"Handler example","icon":"puzzle-piece-simple","href":"/studio/sce/handler-example"}]},{"title":"Schema Contracts","icon":"file-contract","href":"/studio/schema-contracts"},{"title":"Overrides","icon":"overline","href":"/studio/overrides"},{"title":"Changelog","icon":"file-plus-minus","href":"/studio/changelog"},{"group":"Playground++","icon":"rectangle-code","pages":[{"title":"Playground++","icon":"circle-info","sidebarTitle":"Overview","href":"/studio/playground"},{"title":"Collections","icon":"folder-open","href":"/studio/playground/collections"},{"title":"Custom Scripts","icon":"code","href":"/studio/playground/custom-scripts"},{"title":"Sharing Playground Sessions","icon":"share-nodes","href":"/studio/playground/shared-playground-state"},{"title":"Default Headers","icon":"sliders","href":"/studio/playground/default-headers"}]},{"title":"Graph Documentation","icon":"readme","href":"/studio/studio"},{"title":"Compositions","icon":"books","href":"/studio/compositions"},{"group":"Analytics","icon":"chart-line","pages":[{"title":"Analytics","icon":"circle-info","sidebarTitle":"Overview","href":"/studio/analytics"},{"title":"Metrics","icon":"gauge-high","href":"/studio/analytics/metrics"},{"title":"Traces","icon":"route","href":"/studio/analytics/traces"},{"title":"Distributed Tracing","icon":"network-wired","href":"/studio/analytics/distributed-tracing"},{"title":"Schema Field Usage","icon":"chart-column","href":"/studio/analytics/schema-field-usage"},{"title":"Client Identification","icon":"user-group","href":"/studio/analytics/client-identification"}]},{"title":"Operations","icon":"chart-line","href":"/studio/operations"},{"group":"API Keys","icon":"key","pages":[{"title":"API Keys","icon":"circle-info","sidebarTitle":"Overview","href":"/studio/api-keys"},{"title":"API Key Permissions","icon":"shield-halved","href":"/studio/api-keys/api-key-permissions"},{"title":"API Key Resources","icon":"database","href":"/studio/api-keys/api-key-resources"}]},{"title":"Migrate from Apollo","icon":"swap-arrows","href":"/studio/migrate-from-apollo"},{"group":"Alerts and notifications","icon":"alarm-snooze","pages":[{"title":"Alerts And Notifications","icon":"circle-info","sidebarTitle":"Overview","href":"/studio/alerts-and-notifications"},{"title":"Webhooks","icon":"webhook","href":"/studio/alerts-and-notifications/webhooks"},{"title":"Slack Integration","icon":"slack","href":"/studio/alerts-and-notifications/slack-integration"}]},{"title":"Graph Access Control","icon":"user-secret","href":"/studio/graph-access-control"},{"title":"Cluster Management","icon":"layer-group","href":"/studio/cluster-management"},{"title":"Sessions","icon":"shield-plus","sidebarTitle":"Sessions","href":"/studio/sessions"},{"title":"RBAC","icon":"user-tie","href":"/studio/rbac"},{"group":"Groups","icon":"users-rectangle","pages":[{"title":"Groups","icon":"circle-info","sidebarTitle":"Overview","href":"/studio/groups"},{"title":"Group Rules","icon":"database","href":"/studio/groups/group-rules"}]},{"group":"SSO","icon":"building-lock","pages":[{"title":"SSO","icon":"circle-info","sidebarTitle":"Overview","href":"/studio/sso"},{"title":"Okta","icon":"user-shield","href":"/studio/sso/okta"},{"title":"Auth0","icon":"user-lock","href":"/studio/sso/auth0"},{"title":"Keycloak","icon":"key","href":"/studio/sso/keycloak"},{"title":"Microsoft Entra","icon":"microsoft","href":"/studio/sso/microsoft-entra"}]},{"title":"Namespace Login Methods","icon":"lock-keyhole","href":"/studio/namespace-login-methods"},{"title":"Organization Login Methods","icon":"lock-keyhole","href":"/studio/organization-login-methods"},{"group":"SCIM","icon":"file-user","pages":[{"title":"SCIM","sidebarTitle":"Overview","icon":"circle-info","href":"/studio/scim"},{"title":"Okta","icon":"user-shield","href":"/studio/scim/okta"},{"title":"Okta (OIN version)","icon":"shield-check","href":"/studio/scim/okta-oin-version"}]},{"title":"Audit Log","icon":"people-roof","href":"/studio/audit-log"},{"title":"Cosmo AI","icon":"brain-circuit","href":"/studio/cosmo-ai"},{"group":"Policies","icon":"user-police-tie","pages":[{"title":"Policies","icon":"circle-info","sidebarTitle":"Overview","href":"/studio/policies"},{"title":"Linter Rules","icon":"code","href":"/studio/lint-policy/linter-rules"}]},{"title":"Graph Pruning","icon":"broom-wide","href":"/studio/graph-pruning"},{"title":"Invitations","icon":"envelopes-bulk","href":"/studio/invitations"}]},{"group":"Control Plane","pages":[{"title":"Cosmo Control Plane","icon":"door-open","href":"/control-plane/intro"},{"title":"Configuration","icon":"sliders-up","href":"/control-plane/configuration"},{"title":"Webhooks","icon":"webhook","href":"/control-plane/webhooks"}]},{"group":"GraphQL / Federation","pages":[{"title":"Federation Compatibility Matrix","icon":"person-rifle","href":"/federation/federation-compatibility-matrix"},{"group":"Directives","icon":"sign-post","pages":[{"title":"Directives Reference","icon":"list-check","href":"/federation/federation-directives-index"},{"title":"@authenticated","icon":"lock","href":"/federation/directives/authenticated"},{"title":"@composeDirective","icon":"pen-nib","href":"/federation/directives/composeddirective"},{"title":"@connect__fieldResolver","icon":"function","href":"/federation/directives/connect__fieldresolver"},{"title":"@defer","icon":"forward-step","href":"/federation/directives/defer"},{"title":"@deprecated","icon":"triangle-exclamation","href":"/federation/directives/deprecated"},{"title":"@external","icon":"arrow-right-from-bracket","href":"/federation/directives/external"},{"title":"@key","icon":"fingerprint","href":"/federation/directives/key"},{"title":"@link","icon":"link","href":"/federation/directives/link"},{"title":"@openfed configureDescription","icon":"pen-to-square","href":"/federation/directives/openfed__configuredescription"},{"title":"@openfed requireFetchReasons","icon":"magnifying-glass-chart","href":"/federation/directives/openfed__requirefetchreasons"},{"title":"@openfed subscriptionFilter","icon":"filter","href":"/federation/directives/openfed__subscriptionfilter"},{"title":"@provides","icon":"hand-holding","href":"/federation/directives/provides"},{"title":"@requires","icon":"link","href":"/federation/directives/requires"},{"title":"@shareable","icon":"share-nodes","href":"/federation/directives/shareable"},{"title":"@specifiedBy","icon":"link","href":"/federation/directives/specifiedby"},{"title":"@requiresScopes","icon":"key","href":"/federation/directives/requiresscopes"}]},{"group":"Event-Driven Federated Subscriptions","icon":"conveyor-belt-boxes","pages":[{"title":"Event-Driven Federated Subscriptions","sidebarTitle":"Overview","icon":"circle-info","href":"/federation/event-driven-federated-subscriptions"},{"title":"NATS","icon":"puzzle-piece","href":"/federation/event-driven-federated-subscriptions/nats"},{"title":"Kafka","icon":"sitemap","href":"/federation/event-driven-federated-subscriptions/kafka"},{"title":"Redis","icon":"sitemap","href":"/federation/event-driven-federated-subscriptions/redis"},{"title":"Composition Rules","icon":"network-wired","href":"/federation/event-driven-federated-subscriptions/composition-rules"}]},{"title":"Composition Errors","icon":"triangle-exclamation","sidebarTitle":"Composition errors","href":"/federation/composition-errors"}]},{"group":"Deployments and Hosting","pages":[{"title":"Cosmo","icon":"door-open","href":"/deployments-and-hosting/intro"},{"group":"Kubernetes","icon":"layer-group","pages":[{"title":"Kubernetes","sidebarTitle":"Overview","icon":"circle-info","href":"/deployments-and-hosting/kubernetes"},{"group":"Helm Chart","icon":"chart-line","pages":[{"title":"Helm Chart","sidebarTitle":"Overview","icon":"circle-info","href":"/deployments-and-hosting/kubernetes/helm-chart"},{"title":"Cosmo Platform","icon":"dharmachakra","href":"/deployments-and-hosting/kubernetes/helm-chart/cosmo-platform"},{"title":"Router","icon":"router","href":"/deployments-and-hosting/kubernetes/helm-chart/router"}]}]},{"group":"Terraform","icon":"road-bridge","pages":[{"title":"Terraform","icon":"circle-info","sidebarTitle":"Overview","href":"/deployments-and-hosting/terraform"},{"title":"AWS Fargate","icon":"aws","href":"/deployments-and-hosting/terraform/aws-fargate"}]},{"title":"Docker","icon":"docker","href":"/deployments-and-hosting/docker"},{"title":"Release Management","icon":"memo-circle-check","href":"/deployments-and-hosting/release-management"},{"title":"Cosmo Cloud","icon":"cloud","href":"/deployments-and-hosting/cosmo-cloud"}]}]},{"tab":"CLI","icon":"terminal","pages":[{"title":"CLI","href":"/cli/intro"}]},{"tab":"Tutorials","icon":"newspaper","pages":[{"title":"Tutorials","href":"/tutorial"}]}]},"basePath":"","title":"SubscriptionOnCreate Handler - WunderGraph","buildId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","deploymentId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","dynamics":["10e4515597"],"chunks":["BannerMarkdown-CX_qQQOL.js","dist-BTZUMDnx.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-xpJZXxdP.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js"]}