Coder Social home page Coder Social logo

rants's People

Contributors

christophermaier avatar davidmcneil avatar film42 avatar mwrock avatar semtexzv avatar spebern avatar sphqxe avatar taiki-e avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rants's Issues

Error compile

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

Broken pipe when publish message for awhile

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" })

Received invalid server message, invalid control line

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.

Example of a durable subscription

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?

Allow Subjects to be constructed without parsing a String

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.

Example of infinite subscriber

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 to set the timeout of a request

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
}

Allow getting subject name

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.