Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with example #98

Open
kvendi opened this issue Apr 20, 2017 · 1 comment
Open

Error with example #98

kvendi opened this issue Apr 20, 2017 · 1 comment

Comments

@kvendi
Copy link

kvendi commented Apr 20, 2017

Problem with example

pdobryakov@pdobryakov:~/rust/t1$ cat ./src/main.rs 
extern crate stomp;
use stomp::frame::Frame;
use stomp::subscription::AckOrNack::Ack;

fn main() {
  
  let destination = "/topic/messages";
  let mut message_count: u64 = 0;

  let mut session = match stomp::session("127.0.0.1", 61613).start() {
      Ok(session) => session,
      Err(error)  => panic!("Could not connect to the server: {}", error)
   };
  
  session.subscription(destination, |frame: &Frame| {
    message_count += 1;
    println!("Received message #{}:\n{}", message_count, frame);
    Ack
  }).start();
  
  session.message(destination, "Animal").send();
  session.message(destination, "Vegetable").send();
  session.message(destination, "Mineral").send();
  
  session.listen(); // Loops infinitely, awaiting messages

  session.disconnect();
}
pdobryakov@pdobryakov:~/rust/t1$ cargo build
   Compiling t1 v0.1.0 (file:///home/pdobryakov/rust/t1)
error[E0423]: expected function, found module `stomp::session`
  --> src/main.rs:10:27
   |
10 |   let mut session = match stomp::session("127.0.0.1", 61613).start() {
   |                           ^^^^^^^^^^^^^^ not a function

error: aborting due to previous error

error: Could not compile `t1`.

To learn more, run the command again with --verbose.
@zslayton
Copy link
Owner

Thanks for opening this issue. This crate has fallen far behind some of the libraries it's based on (namely mio). Long-term, I hope to rewrite it using Tokio and nom. I'm unsure when I'll get the chance to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants