stomp-rs

Crates.iostomp-rs
lib.rsstomp-rs
version0.0.8
sourcesrc
created_at2021-07-07 20:44:53.950638
updated_at2022-03-25 11:20:48.342228
descriptionSTOMP client
homepage
repositoryhttps://github.com/adhesivee/stomp-rs
max_upload_size
id420045
size57,999
A. Bos (adhesivee)

documentation

README

stomp-rs

Client

Creating new connection:

let client = Client::connect(
    ClientBuilder::new("127.0.0.1:61613")
).await?;

Subscribing:

let (sender, mut receiver) = channel(16);

tokio::spawn(async move {
  match receiver.recv().await {
    Some(frame) => { /* process frame */}
    None => { }
  }
});
client.subscribe(
    Subscribe::new_with_random_id("/topic/test"),
    sender
).await

Sending:

client.send(
    Send::new("/topic/test")
      .body("test-message")
).await

Transaction:

let transaction = client.begin().await?;

transaction.send(
    Send::new("/topic/test")
      .body("test-message")
).await
Commit count: 69

cargo fmt