Crates.io | libmqm-sys |
lib.rs | libmqm-sys |
version | 0.10.1 |
created_at | 2024-04-19 12:10:30.601245+00 |
updated_at | 2025-07-06 22:41:24.867054+00 |
description | IBM® MQ Interface (MQI), Programmable Command Format (PCF) and MQ Administration Interface (MQAI) bindings |
homepage | |
repository | https://github.com/advantic-au/libmqm-sys |
max_upload_size | |
id | 1213619 |
size | 3,912,479 |
Bindings to the IBM® MQ Interface (MQI) and MQ Administration Interface (MQAI) libraries.
You can use libmqm-sys
to:
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 MQ client library or MQ server directly from IBM. Refer to the Usage instructions.
Download and install the client from IBM:
Extract and install the MQ client in any location.
Set the MQ_HOME environment variable to the installed location.
Add the libmqm-sys
crate to your project:
cargo add libmqm-sys
Ensure the MQ libraries are in the library search path. On Linux, this can
be achieved by setting the LD_LIBRARY_PATH
environment variable.
An easy way of running an MQ server for development and testing is to run the IBM supplied docker container:
docker run -d --publish 1414:1414 icr.io/ibm-messaging/mq:latest
Refer to https://github.com/ibm-messaging/mq-container/blob/master/docs/usage.md
use libmqm_sys as mq;
let mut hconn = mq::MQHC_DEF_HCONN;
let mut comp_code = mq::MQCC_UNKNOWN;
let mut reason = mq::MQRC_NONE;
let mut qmgr: mq::MQCHAR48 = [32; 48]; // All spaces = default qmgr
unsafe {
mq::MQCONN(
&qmgr,
&mut hconn,
&mut comp_code,
&mut reason,
);
assert_eq!(reason, mq::MQRC_NONE, "MQRC");
assert_eq!(comp_code, mq::MQCC_OK, "MQCC");
mq::MQDISC(&mut hconn, &mut comp_code, &mut reason);
};
For further examples of using the API, refer to the MQI crate usage.
Feature | Default | Description |
---|---|---|
link | ✔ | Support linking the MQ library at compile-time |
bindgen | 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_* | mqc_9_2_0_0 | Enable features of a specific MQI library version eg mqc_9_3_1_0 |
mqc_latest | Enable features of the latest MQI library version |
The following needs further work:
All feedback, suggestions, contributions and enhancements are welcome.
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.
Licensed under