The WebSphere® MQ API is a set of program interfaces that you can use to request services from the message queue manager.
The WebSphere MQ API (also known as the MQ Interface, or MQI) accesses the message queue manager directly. Because of the complexity of the interface, the ease of making mistakes, and the lack of flexibility, use the MQI only to maintain existing code. New code should use the EGL add and get next statements to access message queue or TOPIC information.
MQ directly API not supported for Publish – subscribe.
EGL provides a set of reusable parts, which are parameters, records, and functions that you can use or modify to make direct calls to the WebSphere MQ API. The source files for these parts are located in the SDP70Shared\plugins\com.ibm.etools.egl.resources_version\MqReusableParts directory.
MQI parameters are either data items or records. The MQSTATE and MQATTRIBUTES sample records contain declarations for most data item parameters.
The BUFFER parameter (message buffer parameter used with MQGET, MQPUT, and MQPUT1 calls) and the CHARATTRS (character attributes buffer parameter used with MQINQ and MQSET calls) are both defined with a length of 1024 characters. Increase the length of these items if you reuse MQSTATE in a program that requires larger buffers.
Sample records are provided to define the format of record parameters and special purpose messages and message headers. Record names are the same as the COBOL structure names. The data items in the records have the same names as the corresponding fields in the COBOL structures, except that the COBOL names use a hyphen (-) as a token separator instead of an underscore.
The following table shows the names of the sample records for direct WebSphere MQ calls.
Record | Description | Initializer function |
---|---|---|
MQBO | Begin options | MQBO_INIT |
MQCNO | Connect options | MQCNO_INIT |
MQDH | Distribution header | MQDH_INIT |
MQDLH | Dead-letter header | MQDLH_INIT |
MQGMO | Get-message options parameter | MQGMO_INIT |
MQINTATTRS | Integer attributes parameter | MQINTATTRS_INIT |
MQMD | Message descriptor parameter | MQMD_INIT |
MQMD1 | Message descriptor (version 1) | MQMD1_INIT |
MQMDE | Message descriptor extension | MQMDE_INIT |
MQOD | Object descriptor parameter | MQOD_INIT |
MQOR | Object record | MQOR_INIT |
MQPMO | Put-message options structure | MQPMO_INIT |
MQRMH | Message reference header | MQRMH_INIT |
MQRR | Response record | MQRR_INIT |
MQSD | Subscription descriptor record | MQSD_INIT |
MQSELECTORS | Attribute selectors parameter | MQSELECTORS_INIT |
MQTM | Trigger message structure | MQTM_INIT |
MQTMC2 | Trigger message 2 (character format) | MQTMC2_INIT |
MQXQH | Transmission queue header | MQXQH_INIT |
The following table shows the sample EGL functions that call WebSphere MQ API functions.
Function | Description |
---|---|
MQCONN | Connect to message queue manager |
MQCONNX | Extended connect |
MQDISC | Disconnect from message queue manager |
MQOPEN | Open a message queue |
MQCLOSE | Close a message queue |
MQGET | Read a message from a queue |
MQPUT | Write a message to a queue |
MQPUT1 | Write a single message to a queue including queue open and close |
MQINQ | Inquire about queue attributes |
MQSET | Set queue attributes |
MQBEGIN | Begin a logical unit of work |
MQCMIT | Commit a logical unit of work |
MQBACK | Back out a logical unit of work |