繁体   English   中英

Rust:连接到 Nats 时出现 MissingOrMalformedExtensions

[英]Rust: MissingOrMalformedExtensions while connecting to Nats

我想使用 Rust 连接到 Nats 服务器。为此,我尝试使用 crate async_nats 那就是文档

这是我的代码:

use futures::StreamExt;

#[tokio::main]
async fn main() -> Result<(), async_nats::Error> {
    let client = async_nats::connect("nats://127.0.0.1:4222").await?;
    // let client = async_nats::connect("127.0.0.1:4222").await?;
    // let client = async_nats::connect("127.0.0.1").await?;
    let mut subscriber = client.subscribe("messages".into()).await?.take(10);

    for _ in 0..10 {
        client.publish("messages".into(), "data".into()).await?;
    }

    while let Some(message) = subscriber.next().await {
        println!("Received message {:?}", message);
    }

    Ok(())
}

它看起来与示例非常相似,但它不起作用。 Rust 消息引起恐慌

Error: Custom { kind: Other, error: "failed to read root certificates: MissingOrMalformedExtensions" }
error: process didn't exit successfully: `target\debug\program.exe` (exit code: 1)

我认为地址可能有问题,所以我尝试了一些变体,但没有帮助。

你能告诉我如何消除这种恐慌吗?

这已被修复

https://github.com/nats-io/nats.rs/pull/788

并将成为下一个版本的一部分。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM