Run Go workers under Portals.
Go workers are compiled programs, so this package plays two roles:
- at build time it provides the Go SDK sources (module
github.com/Ziinc/portals/sdk/go) insidedeps/, which your worker'sgo.modpoints at with areplacedirective — the module is never fetched from the Go module proxy; - at run time
worker_opts/1launches the binary you built.
// go.mod
require github.com/Ziinc/portals/sdk/go v0.0.0
replace github.com/Ziinc/portals/sdk/go => ../deps/portals_go/priv/goRun mix portals.sdk_path go to print the directory to point at.
children = [
{Portals.Pool,
Portals.Go.worker_opts(
binary: Application.app_dir(:my_app, "priv/bin/go_worker"),
name: MyApp.Go,
size: 2
)}
]See the Go guide for a full walkthrough.
Summary
Functions
Build Portals.start_worker/1 / Portals.start_pool/1 options for a
compiled Go worker.
Functions
Build Portals.start_worker/1 / Portals.start_pool/1 options for a
compiled Go worker.
Options
:binary(required) — path to the compiled worker executable.:args— arguments passed to the binary. Portals appends the socket path after these, as the last argument.:env— extra{name, value}environment entries, e.g.[{"GOMAXPROCS", "4"}].
Every other option is passed through unchanged.