davidmcneil / rants Goto Github PK
View Code? Open in Web Editor NEWAn async NATS client library for the Rust programming language.
License: Apache License 2.0
An async NATS client library for the Rust programming language.
License: Apache License 2.0
Hi i have compile errors
error[E0432]: unresolved import tokio::codec
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/codec.rs:8:12
|
8 | use tokio::codec::Decoder;
| ^^^^^ could not find codec
in tokio
error[E0432]: unresolved import tokio::net::TcpStream
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/types/state.rs:2:5
|
2 | use tokio::net::TcpStream;
| ^^^^^^^^^^^^^^^^^^^^^ no TcpStream
in net
error[E0432]: unresolved import tokio_io::split
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/types/state.rs:3:15
|
3 | use tokio_io::split::WriteHalf;
| ^^^^^ could not find split
in tokio_io
error[E0432]: unresolved import tokio::sync::mpsc
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/types.rs:15:18
|
15 | use tokio::sync::mpsc::Sender as MpscSender;
| ^^^^ could not find mpsc
in sync
error[E0432]: unresolved imports tokio::codec
, tokio::io::AsyncWriteExt
, tokio::net::tcp
, tokio::sync::mpsc
, tokio::sync::oneshot
, tokio::sync::watch
, tokio::sync::watch
, tokio::timer
, tokio::timer
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/lib.rs:79:5
|
79 | codec::FramedRead,
| ^^^^^ could not find codec
in tokio
80 | io::AsyncWriteExt,
| ^^^^-------------
| | |
| | help: a similar name exists in the module: AsyncWrite
| no AsyncWriteExt
in io
81 | net::tcp::TcpStream,
| ^^^ could not find tcp
in net
82 | sync::{
83 | mpsc, oneshot,
| ^^^^ ^^^^^^^ no oneshot
in sync
| |
| no mpsc
in sync
84 | watch::{self, Sender as WatchSender},
| ^^^^^ ^^^^ no watch
in sync
| |
| could not find watch
in sync
85 | },
86 | timer::{self, Timeout},
| ^^^^^ ^^^^ no timer
in the root
| |
| could not find timer
in tokio
error[E0432]: unresolved imports tokio_io::split
, tokio_io::split
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/lib.rs:88:23
|
88 | use tokio_io::split::{self, ReadHalf, WriteHalf};
| ^^^^^ ^^^^ no split
in the root
| |
| could not find split
in tokio_io
error[E0432]: unresolved imports tokio::sync::mpsc
, tokio::sync::watch
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/lib.rs:100:23
|
100 | pub use tokio::sync::{mpsc::Receiver as MpscReceiver, watch::Receiver as WatchReceiver};
| ^^^^ ^^^^^ could not find watch
in sync
| |
| could not find mpsc
in sync
error[E0425]: cannot find function spawn
in crate tokio
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/lib.rs:756:20
|
756 | tokio::spawn(Self::type_erased_server_messages_handler(
| ^^^^^ not found in tokio
help: possible candidate is found in another module, you can import it into scope
|
60 | use std::thread::spawn;
|
error[E0425]: cannot find function spawn
in crate tokio
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/lib.rs:778:20
|
778 | tokio::spawn(async move {
| ^^^^^ not found in tokio
help: possible candidate is found in another module, you can import it into scope
|
60 | use std::thread::spawn;
|
error[E0425]: cannot find function spawn
in crate tokio
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/lib.rs:1018:20
|
1018 | tokio::spawn(Self::connect(Client::clone(&wrapped_client)));
| ^^^^^ not found in tokio
help: possible candidate is found in another module, you can import it into scope
|
60 | use std::thread::spawn;
|
error[E0425]: cannot find function spawn
in crate tokio
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/lib.rs:1041:32
|
1041 | tokio::spawn(async move {
| ^^^^^ not found in tokio
help: possible candidate is found in another module, you can import it into scope
|
60 | use std::thread::spawn;
|
error[E0425]: cannot find function spawn
in crate tokio
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/lib.rs:1056:28
|
1056 | tokio::spawn(async move {
| ^^^^^ not found in tokio
help: possible candidate is found in another module, you can import it into scope
|
60 | use std::thread::spawn;
|
error[E0425]: cannot find function spawn
in crate tokio
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/lib.rs:1078:24
|
1078 | tokio::spawn(async move {
| ^^^^^ not found in tokio
help: possible candidate is found in another module, you can import it into scope
|
60 | use std::thread::spawn;
|
error[E0603]: module sync
is private
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/types.rs:15:12
|
15 | use tokio::sync::mpsc::Sender as MpscSender;
| ^^^^
error[E0603]: module sync
is private
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/lib.rs:82:5
|
82 | sync::{
| ^^^^
error[E0603]: module sync
is private
--> /Users/velimir/.cargo/registry/src/github.com-1ecc6299db9ec823/rants-0.3.1/src/lib.rs:100:16
|
100 | pub use tokio::sync::{mpsc::Receiver as MpscReceiver, watch::Receiver as WatchReceiver};
| ^^^^
error: aborting due to 16 previous errors
Some errors have detailed explanations: E0425, E0432, E0603.
For more information about an error, try rustc --explain E0425
.
error: could not compile rants
.
warning: build failed, waiting for other jobs to finish...
error: build failed
See comment here
Client has panic broken pipe error when we publish message for a while, It more easy to reproduce
when turn on : client.connect_mut().await.echo(true);
Err:Io(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" })
Hi, is there any plan to upgrade to tokio 1.0?
For integration tests have a NATS_BIN
environment variable and automatically start the nats server when the tests run. Opposed to requiring the nats server be running for the tests to work.
Address
should allow specifying strings as well as IP addresses. It should allow any address type tokio accepts
Hello,
I have run into an issue connecting to the official NATS server (gnatsd).
Each connection attempt fails with following message:
Received invalid server message, err: invalid control line "INFO {\"server_id\":\"EIcTs1hcrlywWCrsUATcqP\",\"version\":\"1.1.0\",\"git_commit\":\"add6d79\",\"go\":\"go1.9.4\",\"host\":\"0.0.0.0\",\"port\":4222,\"auth_required\":false,\"tls_required\":false,\"tls_verify\":false,\"max_payload\":1048576} \r\n"
The server version is quite old now, so it might be a gnatsd bug.
Hi,
we are working on a PoC Rust application that uses rants
to connect to a Nats Streaming server.
Everything works as expected, anyway, we could not figure out how to perform a durable subscription.
Is a code example available somewhere?
I want to construct subjects programmatically by selecting branches from a subject tree for a given NATS server. I see that Subject's internal representation uses Vec and a flag for wildcards and for a subject hierarchy already represented as a tree of structs in Rust it would make more sense to construct this Vec directly.
This requires async drop
Hey, i have some issue while making an infinite subscriber.
Here is the code:
let addr = std::env::var("NATS_ADDR").unwrap_or_else(|_| "127.0.0.1:4222".into());
let nats_client = Client::new(vec![addr.parse().unwrap()]);
nats_client.connect().await;
let subject = "test".parse().unwrap()
let (_, mut subscription) = nats_client.subscribe(&subject, 1024).await.unwrap();
loop {
let message = subscription.next().await.unwrap();
let message = String::from_utf8(message.into_payload()).unwrap();
info!("Nats message received {}", message);
}
It works but I can't exit the program :/ (no SIGINT catch ?)
I think having an example of this use case should be useful.
How can I set the timeout of a request?
This simple test hangs forever at the client.request(...)
line because nobody replies to the request; anyway, I would like it to fail after some time:
#[tokio::test]
async fn response_should_timeout() {
let subject = "test_subject".parse().unwrap();
let client = rants::Client::new(vec!["127.0.0.1:4222".parse().unwrap()]);
client.connect().await;
client.publish(&subject, b"").await.unwrap();
println!("Publish -> ok");
client.request(&subject, b"").await.unwrap();
println!("Request -> ok"); // <-- this is never printed
}
pub async fn connect(&self)
I tried to use task::block_on (async-std) for above connect function it crashed
I noticed that I can't retrieve the name of a Subject
. If I subscribe to a wildcard/prefix subject such as notifications.>
, I want to be able to inspect which subject I received (e.g. notifications.emergency.accident
, and react to it accordingly.
It looks like the only thing I can do is use Display
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.