pub struct Connection { /* private fields */ }
Expand description
Tcp Connection to NSQ system.
Tries to connect to nsqd early as started:
§Examples
use actix::prelude::*;
use nsq_client::Connection;
fn main() {
let sys = System::new("consumer");
Supervisor::start(|_| Connection::new(
"test", // <- topic
"test", // <- channel
"0.0.0.0:4150", // <- nsqd tcp address
None, // <- config (Optional)
None, // <- secret used by Auth
Some(1) // <- RDY setting for the Connection
));
sys.run();
}
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn new<S: Into<String>>(
topic: S,
channel: S,
addr: S,
config: Option<Config>,
secret: Option<String>,
rdy: Option<u32>,
) -> Connection
pub fn new<S: Into<String>>( topic: S, channel: S, addr: S, config: Option<Config>, secret: Option<String>, rdy: Option<u32>, ) -> Connection
Return a Tcp Connection to nsqd.
topic
- Topic Stringchannel
- Channel Stringaddr
- Tcp address of nsqdconfig
- OptionalConfig
secret
- Optional String used to autenticate to nsqdrdy
- Optional initial RDY setting
Trait Implementations§
Source§impl Actor for Connection
impl Actor for Connection
Source§type Context = Context<Connection>
type Context = Context<Connection>
Actor execution context type
Source§fn started(&mut self, ctx: &mut Context<Self>)
fn started(&mut self, ctx: &mut Context<Self>)
Method is called when actor get polled first time.
Source§fn stopping(&mut self, ctx: &mut Self::Context) -> Running
fn stopping(&mut self, ctx: &mut Self::Context) -> Running
Method is called after an actor is in
Actor::Stopping
state. There
could be several reasons for stopping. Context::stop
get called
by the actor itself. All addresses to current actor get dropped and
no more evented objects left in the context. Read moreSource§fn stopped(&mut self, ctx: &mut Self::Context)
fn stopped(&mut self, ctx: &mut Self::Context)
Method is called after an actor is stopped, it can be used to perform
any needed cleanup work or spawning more actors. This is final state,
after this call actor get dropped.
Source§fn start(self) -> Addr<Self>
fn start(self) -> Addr<Self>
Start new asynchronous actor, returns address of newly created actor. Read more
Source§fn start_default() -> Addr<Self>
fn start_default() -> Addr<Self>
Start new asynchronous actor, returns address of newly created actor.
Source§impl Default for Connection
impl Default for Connection
Source§fn default() -> Connection
fn default() -> Connection
Returns the “default value” for a type. Read more
Source§impl Handler<Backoff> for Connection
impl Handler<Backoff> for Connection
Source§impl Handler<Fin> for Connection
impl Handler<Fin> for Connection
Source§impl Handler<Ready> for Connection
impl Handler<Ready> for Connection
Source§impl Supervised for Connection
impl Supervised for Connection
Source§fn restarting(&mut self, ctx: &mut Self::Context)
fn restarting(&mut self, ctx: &mut Self::Context)
Method called when supervisor restarting failed actor
Auto Trait Implementations§
impl Freeze for Connection
impl !RefUnwindSafe for Connection
impl !Send for Connection
impl !Sync for Connection
impl Unpin for Connection
impl !UnwindSafe for Connection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more