The River client is made available to workers on the context, making it easy to enqueue additional jobs from within a job.
The River client working a job is stored in a value on the context provided to workers. The client can be retrieved from the context (or any contexts derived from it) using the
client := river.ClientFromContext(ctx)
ClientFromContext is called on a context which isn't derived from the work context, it will panic. This situation indicates a programming error so most users will find the panic more convenient, although a non-panicking version is also available:
client, err := river.ClientFromContextSafely(ctx)