Hi Galen, No, that is not currently supported, the current idiomatic way would be to pass those values to the struct implementing the Statefun interface.
type MyFunc struct { someRuntimeInfo string } func (m *MyFunc) Invoke(ctx statefun.Context, message statefun.Message) error { } func main() { builder := statefun.StatefulFunctionsBuilder() f := MyFunc { someRuntimeInfo: "runtime-provided" } builder.WithSpec (statefun.StatefulFunctionSpec{ FunctionType: statefun.TypeNameFrom( "example/my-func"), Function: f }) http.Handle("/statefun", builder.AsHandler()) _ = http.ListenAndServe(":8000", nil) } Would this work for you? Or what is the context (pun intended) you are looking for? Seth On Wed, Feb 16, 2022 at 4:35 PM Galen Warren <ga...@cvillewarrens.com> wrote: > When stateful functions are invoked, they are passed an instance of > statefun.Context, which wraps the context.Context received by the HTTP > request. Is there any way to customize that context.Context to, say, hold > custom values, using ctx.WithValue()? I don't see a way but I wanted to > ask. > > If not, would you be interested in a PR to add this functionality? A simple > way might be to add a property to StatefulFunctionSpec, say: > > TransformContext func(ctx context.Context) context.Context > > ... that, if supplied, would be called to create a customized context that > would be used downstream? > > Thanks. >