API reference
This is a quick overview of the API surface you’d be interacting with most of the time. There’s also a full API reference available.
dispatch.Func
Define a function, execution of which will be powered by Dispatch.
function.Dispatch
Execute a function asynchronously.
function.Await
Execute a function asynchronously and wait for its result.
Note that Await
only works inside another function defined with dispatch.Func
.
function.Gather
Execute the same function asynchronously for each argument.
dispatch.New
Initialize Dispatch SDK with a list of functions as arguments.
dispatch.ListenAndServe
Start the HTTP server at localhost:8000
and initialize a handler that Dispatch will use to remotely execute functions defined via dispatch.Func
.
endpoint.Handler
Create a handler that Dispatch will use to remotely execute functions defined via dispatch.Func
, that is suitable to integrate into an existing HTTP server.
Errors
Each error type instructs Dispatch whether to retry executing a function or not.
In addition to retries, different error types can impact the concurrency rate at which Dispatch executes your function.
For example, when a function returns ErrThrottled
, concurrency rate is decreased to reduce the load on your system.
When function starts successfully executing again, concurrency rate is increased back up.
dispatch.ErrTemporary
Retry: Yes.
Concurrency: Decrease.
Function encountered a temporary error that may resolve soon.
dispatch.ErrPermanent
Retry: No.
Concurrency: Increase.
Function encountered a permanent error.
dispatch.ErrTimeout
Retry: Yes.
Concurrency: Decrease.
Function encountered a timeout.
dispatch.ErrThrottled
Retry: Yes.
Concurrency: Decrease.
Function was throttled.
dispatch.ErrUnauthenticated
Retry: No.
Concurrency: Increase.
Function attempted to perform an operation without authentication.
dispatch.ErrPermissionDenied
Retry: No.
Concurrency: Increase.
Function attempted to perform an operation without permission.
dispatch.ErrNotFound
Retry: No.
Concurrency: Increase.
FUnction attempted to access a non-existent resource.
dispatch.ErrInvalidArgument
Retry: No.
Concurrency: Increase.
Function was provided invalid input.
dispatch.ErrInvalidResponse
Retry: No.
Concurrency: Increase.
Function encountered an unexpected response from other part of the system.
dispatch.ErrDNS
Retry: Yes.
Concurrency: Decrease.
Function encountered a DNS error.
dispatch.ErrTCP
Retry: Yes.
Concurrency: Decrease.
Function encountered a TCP error.
dispatch.ErrTLS
Retry: Yes.
Concurrency: Decrease.
Function encountered a TLS error.
dispatch.ErrHTTP
Retry: Yes.
Concurrency: Decrease.
Function encountered an HTTP error.