0.2.0 (2024-09-17)
The Invoker
struct has been refactored to extend its usability through the use
of optional functions that can override the default behavior.
-
[Breaking Change] The
Controller
interface and theInvoker
struct now accept a variadic list of functional options to further customize their behavior:WithInvokeTopic()
: Invokes the functions that match the topic.WithInvokeAsyncCallbackURL()
: Sets the callback URL for asynchronous invocations.WithInvokeContentType()
: Sets the content type for the invoker.
-
[Breaking Change] The
Invoker
constructor now accepts a variadic list of functional options:WithInvokerSendTopic()
: Whether to send the topic in the invocation request headers.WithInvokerAsyncCallbackURL()
: Sets the callback URL for asynchronous invocations.WithInvokerUserAgent()
: Sets the user agent for the invoker.
-
The
go-sdk
package has been added as a dependency to replace thefaas-provider
for authentication and some requests to the OpenFaaS gateway.
- [Breaking Change] Updated faas-provider to v0.25.4.
- [Breaking Change] The
controller
andFunctionLookupBuilder
structs now accept asdk.Clientauth
instance for authentication.
- All the original
Invoke...()
methods have been removed from theInvoker
struct. They have been replaced by theInvoke()
andInvokeWithContext()
methods.
0.1.0 (2021-07-30)
- Namespace filtering.
This is useful in multi-tenant environments. If a namespace is set in the
ControllerConfig
instance, only the functions in that namespace will be mapped. Otherwise, all functions will be mapped (regardless of their namespace).config := &types.ControllerConfig{ ... Namespace: namespace, }
- Callback URL for asynchronous invocations.
A callback URL can be set using
AsyncFunctionCallbackURL
:config := &types.ControllerConfig{ ... AsyncFunctionInvocation: true, AsyncFunctionCallbackURL: asyncCallbackURL, }
- Custom topic matcher.
A custom function can be used for topic matching to override the default
equality check between received topic and function topic.
matchLowercase := func(topic, route string) bool { return strings.ToLower(topic) == strings.ToLower(route) } config := &types.ControllerConfig{ ... TopicMatcher: matchLowercase, }
- Send message topic to function.
To give some context to the invoked functions, the topic can optionally be
sent in the invocation requests in an
X-Topic
header.config := &types.ControllerConfig{ ... SendTopic: true, }
- Invoke functions without a topic.
A topic may be not required in many applications. The
Invoker
includes two new methods to allow invoking a function using its name instead of a topic.invoker.InvokeFunction("my-function.my.namespace", message, headers) invoker.InvokeFunctionWithContext(ctx, "my-function.my.namespace", message, headers)