libmqm-sys

Crates.iolibmqm-sys
lib.rslibmqm-sys
version
sourcesrc
created_at2024-04-19 12:10:30.601245
updated_at2024-12-03 21:51:01.004718
descriptionIBM® MQ Interface (MQI) and MQ Administration Interface (MQAI) bindings
homepage
repositoryhttps://github.com/advantic-au/libmqm-sys
max_upload_size
id1213619
Cargo.toml error:TOML parse error at line 20, column 1 | 20 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Warren Spits (spitsw)

documentation

README

libmqm-sys

Latest version Documentation License

Bindings to the IBM® MQ Interface (MQI) and MQ Administration Interface (MQAI) libraries.

You can use libmqm-sys to:

  • Connect to an IBM MQ server to send and receive MQ messages through the MQI functions
  • Administer IBM MQ server through the MQAI functions

Functions provided in this crate are the raw unsafe functions exposed from the IBM provided library. Developers should build safe rust API wrappers over these functions. Developers who do not want to use the unsafe API should use the mqi crate for a safe API over the MQI.

Compile time dynamic linking and run-time dynamic linking is supported.

Developers must download the MQI library directly from IBM. Refer to the Usage instructions.

Usage

  1. Download and install the redistributable client from IBM: https://ibm.biz/mq94redistclients

  2. Install the client in /opt/mqm or another location.

  3. Set the MQ_HOME environment variable to the installed location.

    MQ_HOME=/opt/mqm
    
  4. Add the libmqm-sys crate to your project:

    cargo add libmqm-sys
    
  5. Use the crate in your source code:

    use libmqm-sys as mqsys;
    

Example

use std::ptr::addr_of_mut;
use libmqm_sys::lib;

let mut hconn = lib::MQHC_DEF_HCONN;
let mut comp_code = lib::MQCC_UNKNOWN;
let mut reason = lib::MQRC_NONE;
let mut qmgr: [lib::MQCHAR; 48] = [32; 48]; // All spaces = default qmgr

unsafe {
    lib::MQCONN(
        addr_of_mut!(qmgr).cast(),
        addr_of_mut!(hconn),
        addr_of_mut!(comp_code),
        addr_of_mut!(reason),
    );
    assert_eq!(reason, lib::MQRC_NONE, "MQRC");
    assert_eq!(comp_code, lib::MQCC_OK, "MQCC");
    lib::MQDISC(addr_of_mut!(hconn), addr_of_mut!(comp_code), addr_of_mut!(reason));
};

For further examples of using the API, refer to the MQI crate usage.

Feature flags

Feature Description
link (default) Support linking the MQ library at compile-time
bindgen (default) Generate the bindings from MQI library
dlopen2 Support loading the MQ library at run-time using dlopen2
mqai Expose the MQAI functions
pcf Generate the PCF structures
exits Generate the exit structures
mqc_* Enable features of a specific MQI library version eg mqc_9_3_1_0

Status

The following needs further work:

  • Documentation

Contributions

All feedback, suggestions, contributions and enhancements are welcome.

Support

There are no guarantees of compatibility with any future versions of the crate; the API is subject to change based on feedback and enhancements. Relentless refactoring may occur before a stable crate is released.

This crate is provided as-is with no guarantees of support or updates.

This crate is not approved, endorsed, acknowledged, or supported by IBM. You cannot use IBM formal support channels (Cases/PMRs) for assistance on the use of this crate.

License

Licensed under

Commit count: 115

cargo fmt