https://github.com/bigbuildbench/cetra3_tmq

https://github.com/bigbuildbench/cetra3_tmq

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.9%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: BigBuildBench
  • Language: Rust
  • Default Branch: master
  • Size: 220 KB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme

README.md

TMQ - Rust ZeroMQ bindings for Tokio

This crate bridges Tokio and ZeroMQ to allow for ZeroMQ in the async world.

Crates.io Docs.rs MIT licensed

Changelog

0.5.0 - Extra setters/getters & new rust edition

  • Added setters for curve key encryption #45
  • Remove Redundant Imports #43
  • Add more socket options & bump edition #46

0.4.0 - Bump Deps

Bump Deps & Pin future in RequestSender #39

0.3.1 - Iter Mut for Multipart

Adds an iter_mut() method to Multipart

0.3.0 - Tokio 1.0 Support

0.3.0 adds support for tokio 1.0 thanks to YushiOMOTE!

Currently Implemented Sockets

  • Request/Reply
  • Publish/Subscribe
  • Dealer/Router
  • Push/Pull

Examples

Please see the examples directory for a full set of examples. They are paired together based upon the socket types.

Usage

Usage is made to be simple, but opinionated. See the examples for working code, but in general, you need to import tokio and tmq::*

Publish

To publish messages to all connected subscribers, you can use the publish function:

```rust use tmq::{publish, Context, Result};

use futures::SinkExt; use log::info; use std::env; use std::time::Duration; use tokio::time::delay_for;

[tokio::main]

async fn main() -> Result<()> {

let mut socket = publish(&Context::new()).bind("tcp://127.0.0.1:7899")?;

let mut i = 0;

loop {
    i += 1;

    socket
        .send(vec!["topic", &format!("Broadcast #{}", i)])
        .await?;

    delay_for(Duration::from_secs(1)).await;
}

} ```

Subscribe

a subscribe socket is a Stream that reads in values from a publish socket. You specify the filter prefix using the subscribe method, using "" for all messages.

```rust use futures::StreamExt;

use tmq::{subscribe, Context, Result};

use std::env;

[tokio::main]

async fn main() -> Result<()> {

let mut socket = subscribe(&Context::new())
    .connect("tcp://127.0.0.1:7899")?
    .subscribe(b"topic")?;

while let Some(msg) = socket.next().await {
    println!(
        "Subscribe: {:?}",
        msg?.iter()
            .map(|item| item.as_str().unwrap_or("invalid text"))
            .collect::<Vec<&str>>()
    );
}
Ok(())

} ```

Owner

  • Name: BigBuildBench
  • Login: BigBuildBench
  • Kind: organization

abbr. B3, benchmarking the repo-level understanding capability of your LLMs by reconstructing project build-file.

GitHub Events

Total
  • Create event: 4
Last Year
  • Create event: 4

Dependencies

.github/workflows/test.yml actions
  • actions-rs/cargo v1 composite
  • actions-rs/toolchain v1 composite
  • actions/checkout v2 composite
Cargo.toml cargo
  • criterion 0.5 development
  • pretty_env_logger 0.5 development
  • rand 0.8 development
  • tokio 1 development