69 releases

0.5.1 Jan 27, 2023
0.4.16 Oct 6, 2022
0.4.12 Jul 5, 2022
0.4.7 Mar 22, 2022
0.1.14 Nov 30, 2020

#447 in Text processing

Download history 155/week @ 2023-11-18 76/week @ 2023-11-25 41/week @ 2023-12-02 64/week @ 2023-12-09 316/week @ 2023-12-16 6/week @ 2023-12-23 502/week @ 2023-12-30 209/week @ 2024-01-06 260/week @ 2024-01-13 290/week @ 2024-01-20 381/week @ 2024-01-27 373/week @ 2024-02-03 190/week @ 2024-02-10 207/week @ 2024-02-17 123/week @ 2024-02-24 287/week @ 2024-03-02

807 downloads per month

Apache-2.0

135KB
2.5K SLoC

tibco_ems

Latest Version

A high-level API for the Tibco EMS C library.

Build

To build this crate, the TIBCO EMS C library must either be in the LD_LIBRARY_PATH or alternatively a EMS_HOME environment variable must be set.

Please check the CHANGELOG when upgrading.

Examples

Sending a text message to a queue.

use tibco_ems::Destination;
use tibco_ems::TextMessage;

fn main() {
  let url = "tcp://localhost:7222";
  let user="admin";
  let password="admin";

  let connection = tibco_ems::connect(url,user,password).unwrap();
  let session = connection.session().unwrap();

  let msg = TextMessage{
    body:"hallo welt".to_string(),
    ..Default::default()
  };

  let destination = Destination::Queue("myqueue".to_string());
  
  let _ignore = session.send_message(&destination, msg);
}

Receiving a text message from a queue.

use tibco_ems::Destination;
use tibco_ems::Message;

fn main() {
  let url = "tcp://localhost:7222";
  let user="admin";
  let password="admin";

  let connection = tibco_ems::connect(url,user,password).unwrap();
  let session = connection.session().unwrap();

  let destination = Destination::Queue("myqueue".to_string());
  let consumer = session.queue_consumer(&destination, None).unwrap();
  
  println!("waiting 10 seconds for a message");
  let msg_result = consumer.receive_message(Some(10000));

  match msg_result {
    Ok(result_value) => {
      match result_value {
        Some(message) => {
          match &message {
            Message::TextMessage(text_message) =>{
              println!("received text message");
              println!("content: {}", text_message.body);
            },
            _ => {
              println!("unknown type");
            }
          }    
        },
        None =>{
          println!("no message returned");
        },
      }
    },
    Err(status) => {
      println!("returned status: {:?}",status);
    }
  }
}

More examples can be found in the examples directory.

License

tibco_ems is licensed under Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0).

TIBCO Enterprise Messaging Service, and all related components therein are property of TIBCO Software, and are not provided with this software package. Refer to your own TIBCO License terms for details.

Dependencies

~0.5–1.8MB
~36K SLoC