pub struct ConsumerBuilder<E> { /* private fields */ }
Expand description

Convenience wrapper for building a Faktory worker.

See the Consumer documentation for details.

Implementations§

Set the hostname to use for this worker.

Defaults to the machine’s hostname as reported by the operating system.

Set a unique identifier for this worker.

Defaults to a randomly generated ASCII string.

Set the labels to use for this worker.

Defaults to ["rust"].

Set the number of workers to use for run and run_to_completion_*.

Defaults to 1.

Register a handler function for the given job type (kind).

Whenever a job whose type matches kind is fetched from the Faktory, the given handler function is called with that job as its argument.

Connect to a Faktory server.

If url is not given, will use the standard Faktory environment variables. Specifically, FAKTORY_PROVIDER is read to get the name of the environment variable to get the address from (defaults to FAKTORY_URL), and then that environment variable is read to get the server address. If the latter environment variable is not defined, the connection will be made to

tcp://localhost:7419

If url is given, but does not specify a port, it defaults to 7419.

Connect to a Faktory server with a non-standard stream.

Trait Implementations§

Construct a new worker with default worker options and the url fetched from environment variables.

This will construct a worker where:

  • hostname is this machine’s hostname.
  • wid is a randomly generated string.
  • pid is the OS PID of this process.
  • labels is ["rust"].

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.