Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: inject topics/subscriptions in go #3394

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

worstell
Copy link
Contributor

@worstell worstell commented Nov 15, 2024

go:
type MyTopic = ftl.TopicHandle[MyEvent]
schema:
topic myTopic foo.MyEvent

go:
type MySubscription = ftl.SubscriptionHandle[MyTopic, MySinkClient, MyEvent]
schema:
subscription mySubscription foo.MyEvent

This was referenced Nov 15, 2024
@worstell worstell force-pushed the worstell/20241114-pubsub-injection branch from e747065 to 2d24683 Compare November 15, 2024 01:23
Base automatically changed from worstell/20241114-publisher-metadata to main November 18, 2024 17:49
@worstell worstell force-pushed the worstell/20241114-pubsub-injection branch 2 times, most recently from 31ba8b6 to 0f01e0c Compare November 19, 2024 19:25
@worstell worstell changed the base branch from main to worstell/20241119-deterministic-order-for-verb-resources November 19, 2024 19:25
@worstell worstell force-pushed the worstell/20241119-deterministic-order-for-verb-resources branch 2 times, most recently from 10b9386 to 366f26b Compare November 19, 2024 20:58
Base automatically changed from worstell/20241119-deterministic-order-for-verb-resources to main November 19, 2024 23:46
@worstell worstell force-pushed the worstell/20241114-pubsub-injection branch 3 times, most recently from 8e1ee84 to 65f6b88 Compare November 19, 2024 23:58
@@ -565,7 +567,8 @@ func testErrorReporting(t *testing.T) {
`146:6-45: enum discriminator "TypeEnum3" cannot contain exported methods`,
`149:6-35: enum discriminator "NoMethodsTypeEnum" must define at least one method`,
`161:3-14: unexpected token "d"`,
`168:2-62: can not publish directly to topics in other modules`,
// todo: do we want this? why do we support exporting topics if so?
//`168:2-62: can not publish directly to topics in other modules`,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this check be removed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah we still want this limitation. We export topics so that subscriptions in other modules can subscribe to them. But we don't want to let anyone publish to topics directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok cool, i'll restrict that via the generated external module so there's no Publish method at all

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually that won't work. will keep the static check

@worstell worstell force-pushed the worstell/20241114-pubsub-injection branch 2 times, most recently from cc3d236 to 29f4e24 Compare November 20, 2024 21:10
@@ -438,67 +438,6 @@ func getDSNFromSecret(ftl internal.FTL, module, name string) (string, error) {
return dsn, nil
}

// WithSubscriber adds a subscriber during a test
Copy link
Contributor Author

@worstell worstell Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be reimplementing test helpers with a different strategy separately

@worstell worstell force-pushed the worstell/20241114-pubsub-injection branch 5 times, most recently from 97232ae to b446f7e Compare November 21, 2024 20:51
@worstell worstell changed the title wip: feat: inject topics/subscriptions in go feat: inject topics/subscriptions in go Nov 21, 2024
@worstell worstell force-pushed the worstell/20241114-pubsub-injection branch from 45afd0b to 26ea38c Compare November 21, 2024 20:59
@worstell worstell marked this pull request as ready for review November 21, 2024 20:59
@worstell worstell requested review from a team and alecthomas as code owners November 21, 2024 20:59
@worstell worstell removed the request for review from a team November 21, 2024 20:59
@worstell worstell requested review from stuartwdouglas and wesbillman and removed request for a team November 21, 2024 20:59
@worstell worstell force-pushed the worstell/20241114-pubsub-injection branch 2 times, most recently from 99f183e to c094dc2 Compare November 21, 2024 21:10
@worstell worstell force-pushed the worstell/20241114-pubsub-injection branch 3 times, most recently from 24e9479 to 8ca7ac7 Compare November 25, 2024 17:40
@worstell worstell force-pushed the worstell/20241114-pubsub-injection branch from c551c75 to d3effd0 Compare November 25, 2024 18:39
@worstell worstell merged commit bf98d2e into main Nov 25, 2024
93 checks passed
@worstell worstell deleted the worstell/20241114-pubsub-injection branch November 25, 2024 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants