Integration of WebSphere MQ Telemetry with queue managers
The MQTT client is integrated with WebSphere MQ as a publish/subscribe application. It can either publish or subscribe to topics in WebSphere MQ, creating new topics, or using existing topics. It receives publications from WebSphere MQ as a result of MQTT clients, including itself, or other WebSphere MQ applications publishing to the topics of its subscriptions. Rules are applied to decide the attributes of a publication.
Many of the attributes associated with topics, publications, subscriptions, and messages that are provided by WebSphere MQ, are not supported. MQTT client to WebSphere MQ publish/subscribe broker and WebSphere MQ to an MQTT client describe how attributes of publications are set. The settings depend on whether the publication is going to or from the WebSphere MQ publish/subscribe broker.
In WebSphere
MQ publish/subscribe topics are associated with administrative topic
objects. The topics created by MQTT clients are no different. When
an MQTT client creates a topic string for a publication the WebSphere
MQ publish/subscribe broker associates it with an administrative topic
object. The broker maps the topic string in the publication to the
nearest administrative topic object parent. The mapping is the same
as for WebSphere MQ applications. If there is no user created topic,
the publication topic is mapped to SYSTEM.BASE.TOPIC
.
The attributes that are applied to the publication are derived from
the topic object.
When a WebSphere MQ application, or an administrator creates a subscription, the subscription is
named. List subscriptions using WebSphere MQ Explorer, or by using
runmqsc or PCF commands. All MQTT client subscriptions are named. They are given a name of the form:
ClientIdentifier:Topic name
MQTT client to WebSphere MQ publish/subscribe broker
MQMD properties are set to their default values, except where noted in Table 1.
MQMD field | Type | Value |
---|---|---|
Format | MQCHAR8 |
|
UserIdentifier | MQCHAR12 |
Set to one of:
|
Priority | MQLONG |
|
Persistence | MQLONG |
|
The RFH2 header does not contain an <msd>
folder
to define the type of the JMS message. The telemetry (MQXR) service creates
the WebSphere MQ message as a default JMS message. The default JMS
message-type is a jms-bytes
message. An application
can access additional header information as message properties; see Message properties.
RFH2 values are set as shown in Table 2. The Format property is set in the RFH2 fixed header and the other values are set in RFH2 folders.
RFH2 property | Type/Folder | Header |
---|---|---|
Format | MQCHAR8 |
|
ClientIdentifier | mqtt/clientId |
Copy MqttClient.ClientIdentifier with a length of 1...23 bytes. |
QoS | mqtt/qos |
Copy QoS from incoming MQTT message. |
Message ID | mqtt/msgid |
Copy Message ID from incoming
MQTT message, if QoS is |
MQIsRetained | mqps/Ret |
Set if the original MQTT
publication was sent with the |
MQTopicString | mqps/Top |
The topic to which the MQTT message was published. |
The payload in an MQTT publication is mapped to the contents of a WebSphere MQ message:
Message contents | Type | Contents |
---|---|---|
Buffer | MQBYTEn |
Copy of bytes from incoming MQTT message. The length can be zero. |
WebSphere MQ to an MQTT client
A client has subscribed to a publication topic. A WebSphere MQ application has published to the topic, resulting in a publication being sent to the MQTT subscriber by the WebSphere MQ publish/subscribe broker. Alternatively, a WebSphere MQ application has sent an unsolicited message directly to an MQTT client. Table 4 describes how the fixed message headers are set in the message that is sent to the MQTT client. Any other data in the WebSphere MQ message header, or any other headers, are discarded. The message data in the WebSphere MQ message is sent as the message payload in the MQTT message, with no alteration. The MQTT message is sent to the MQTT client by the telemetry (MQXR) service.
MQTT field | Type | Value |
---|---|---|
DUP | boolean | Set if |
QoS | int | The way the value of QoS in
an outgoing publication from the publish/subscribe broker in WebSphere
MQ is set depends on the incoming publication. It depends on whether
the incoming publication was sent from an MQTT client, or from a WebSphere
MQ application.
|
RETAIN | boolean | Set if the incoming publication has the retained property set. |
Table 5 describes how the variable message headers are set in the MQTT message that is sent to the MQTT client.
MQTT field | Type | Value |
---|---|---|
Topic name | String | The topic string the message was published with. |
Message ID | String | The last 2 bytes of the MQMD.MsgId property
of the publication when it is placed in |
Payload | byte[] | Direct copy of bytes from incoming publication to the publish/subscribe broker. The length can be zero. |