You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently every exported function must be a "verb", accepting a request and returning a response, but we need to support declaring sources and sinks (as per the primitives doc) in order to implement PubSub, but also because sometimes you just don't care about the request or response.
Fixes#1065
SOLVED: Some things to figure out still:
These were solved by assuming anything without a req is a source,
anything without a resp, is a sink, and anything without either is
empty.
1. How to use `Handle` with these new definitions. Since the signature
no longer matches the `Handle` func, what should we do here? The
generated code here will fail:
```go
func main() {
verbConstructor := server.NewUserVerbServer("time",
server.Handle(time.Time),
server.Handle(time.Sink), // these both have build errors since they
don't match the expected signature
server.Handle(time.Source),
)
plugin.Start(context.Background(), "time", verbConstructor,
ftlv1connect.VerbServiceName, ftlv1connect.NewVerbServiceHandler)
}
```
2. How should we deal with the fact that the generated code doesn't
match the original signature? This also leads to issues using things
like `ftl.callSink` and `ftl.callSource` since the generated code
doesn't match the signature.
```go
// original
//ftl:verb
func Source(context.Context) (SourceResp, error) {
return SourceResp{}, nil
}
// generated
//ftl:verb
func Source(context.Context, ftl.Unit) (SourceResp, error) {
panic("Verb stubs should not be called directly, instead use
github.com/TBD54566975/ftl/runtime-go/ftl.Call()")
}
```
Currently every exported function must be a "verb", accepting a request and returning a response, but we need to support declaring sources and sinks (as per the primitives doc) in order to implement PubSub, but also because sometimes you just don't care about the request or response.
That is, we want to be able to accept:
We could also support neither request nor response, but we don't need this for PubSub.
(the same should apply in Kotlin)
The missing values can be represented in the schema as
Unit
, eg.We'll also need to add additional
ftl.CallSink()
andftl.CallSource()
helpers, and equivalent in Kotlin.The text was updated successfully, but these errors were encountered: