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]
fn hostname(&mut self, hn: String) -> &mut Self
[src]
Set the hostname to use for this worker.
Defaults to the machine's hostname as reported by the operating system.
fn wid(&mut self, wid: String) -> &mut Self
[src]
Set a unique identifier for this worker.
Defaults to a randomly generated ASCII string.
fn labels(&mut self, labels: Vec<String>) -> &mut Self
[src]
Set the labels to use for this worker.
Defaults to ["rust"]
.
fn workers(&mut self, w: usize) -> &mut Self
[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]
F: Fn(Job) -> Result<(), E> + Send + Sync + 'static,
fn register<K>(&mut self, kind: K, handler: F) -> &mut Self where
K: ToString,
[src]
K: ToString,
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.
fn connect(self, url: Option<&str>) -> Result<Consumer<TcpStream, F>>
[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.
fn connect_with<S: Read + Write>(
self,
stream: S,
pwd: Option<String>
) -> Result<Consumer<S, F>>
[src]
self,
stream: S,
pwd: Option<String>
) -> Result<Consumer<S, F>>
Connect to a Faktory server with a non-standard stream.
Trait Implementations
impl<F: Clone> Clone for ConsumerBuilder<F>
[src]
fn clone(&self) -> ConsumerBuilder<F>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more