diff --git a/async-nats/src/lib.rs b/async-nats/src/lib.rs index 101b2eced..2c24356e4 100644 --- a/async-nats/src/lib.rs +++ b/async-nats/src/lib.rs @@ -679,7 +679,8 @@ impl ConnectionHandler { let multiplexer = if let Some(multiplexer) = self.multiplexer.as_mut() { multiplexer } else { - let subject = format!("{}.*", prefix); + let prefix = format!("{}.{}.", prefix, nuid::next()); + let subject = format!("{}*", prefix); self.connection.enqueue_write_op(&ClientOp::Subscribe { sid: MULTIPLEXER_SID, @@ -689,7 +690,7 @@ impl ConnectionHandler { self.multiplexer.insert(Multiplexer { subject, - prefix: format!("{}.", prefix), + prefix, senders: HashMap::new(), }) }; @@ -699,7 +700,7 @@ impl ConnectionHandler { let pub_op = ClientOp::Publish { subject, payload, - respond: Some(respond), + respond: Some(format!("{}{}", multiplexer.prefix, token)), headers, };