tibco_ems

Latest Version

Rust bindings for the Tibco EMS C library.

A high-level API is provided to simplify the interaction. Since the high-level API does not fully cover the EMS capabilities, a low-level binding in provided by the sub-module tibcoems::cbinding.

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.

Build

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

Usage

Put this in your Cargo.toml:

text [dependencies] tibco_ems = "0.1"

Examples

Sending a text message to a queue.

```rust use tibcoems::Destination; use tibcoems::DestinationType; use tibco_ems::TextMessage;

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

let connection = tibcoems::connect(url.tostring(),user.tostring(),password.tostring());

let session = tibco_ems::session(connection);

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

let destination = Destination{ destinationtype: DestinationType::Queue, destinationname: "myqueue".tostring(), }; tibcoems::sendtextmessage(session, destination, msg);

tibcoems::sessionclose(session); } ```

Receiving a text message from a queue.

```rust use tibcoems::Destination; use tibcoems::DestinationType; use tibcoems::TextMessage; use tibcoems::MessageType;

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

let connection = tibcoems::connect(url.tostring(),user.tostring(),password.tostring());

let session = tibco_ems::session(connection);

let destination = Destination{ destinationtype: DestinationType::Queue, destinationname: "myqueue".tostring(), }; let consumer = tibcoems::queue_consumer(session,destination,None);

let msg = tibcoems::receivemessage(consumer, None);

match msg.messagetype { MessageType::TextMessage =>{ println!("received text message"); let textmessage = TextMessage::from(msg); println!("content: {}", textmessage.body); }, _ => { println!("unknown type"); } } tibcoems::session_close(session); } ```

More examples can be found in the examples directory.