Struct background_jobs_server::SpawnerConfig
source · pub struct SpawnerConfig { /* private fields */ }
Expand description
SpawnerConfig is the only part of this library required to actually exist in your application.
This type is used to queue new jobs into the background-jobs
server.
ⓘ
let spawner = SpawnerConfig::new("localhost", 5555);
tokio::spawn(
spawner
.queue::<MyProcessor>(job)
.map_err(|_| ()),
);
Implementations
sourceimpl SpawnerConfig
impl SpawnerConfig
sourcepub fn new(server_host: &str, base_port: usize) -> Self
pub fn new(server_host: &str, base_port: usize) -> Self
Create a SpawnerConfig
server_host
is the hostname or IP address of the host that the server is running onbase_port
is the samebase_port
from the server config. The spawner will only ever need to communicate overbase_port
sourcepub fn new_with_context(
server_host: &str,
base_port: usize,
ctx: Arc<Context>
) -> Self
pub fn new_with_context(
server_host: &str,
base_port: usize,
ctx: Arc<Context>
) -> Self
The same as SpawnerConfig::new()
, but with a provided ZeroMQ Context.
This can be useful if you have other uses of ZeroMQ in your application, and want to share a context with your dependencies.
If you’re running the Server, Worker, and Spawner in the same application, you should share a ZeroMQ context between them.
Auto Trait Implementations
impl RefUnwindSafe for SpawnerConfig
impl Send for SpawnerConfig
impl Sync for SpawnerConfig
impl Unpin for SpawnerConfig
impl UnwindSafe for SpawnerConfig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more