Struct faktory::ConsumerBuilder [] [src]

pub struct ConsumerBuilder<F> { /* fields omitted */ }

Convenience wrapper for building a Faktory worker.

See the Consumer documentation for details.

Methods

impl<F> ConsumerBuilder<F>
[src]

[src]

Set the hostname to use for this worker.

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

[src]

Set a unique identifier for this worker.

Defaults to a randomly generated ASCII string.

[src]

Set the labels to use for this worker.

Defaults to ["rust"].

[src]

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

Defaults to 1.

impl<F, E> ConsumerBuilder<F> where
    F: Fn(Job) -> Result<(), E> + Send + Sync + 'static, 
[src]

[src]

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.

[src]

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.

[src]

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

Trait Implementations

impl<F: Clone> Clone for ConsumerBuilder<F>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<F> Default for ConsumerBuilder<F>
[src]

[src]

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"].