-
Notifications
You must be signed in to change notification settings - Fork 0
Calling Functions
Chris O'Hara edited this page Jul 1, 2024
·
9 revisions
After defining a function and registering it with a Dispatch endpoint, the next step is to dispatch a call.
Given a Dispatch function that converts an integer to a string:
stringify := dispatch.Func("stringify", func (ctx context.Context, input int) (string, error) {
return strconv.Itoa(input), nil
})A function call can be dispatched using the Dispatch method, which accepts an input argument.
For example, to dispatch a stringify(11) call:
id, err := stringify.Dispatch(context.Background(), 11)This submits a function call to the Dispatch cloud service, which coordinates the execution of the function.
The Dispatch method returns a globally unique identifier for the function call, for observability purposes.
If the function call could not be dispatched, an error is instead returned.
TODO