About the MQHeader node sample

This node simplifies the creation, modification, and deletion of two MQ headers: MQMD and MQDLH. Use the MQHeader node to add, modify, or delete MQMD (MQ Message Descriptor) and MQDLH (MQ Dead Letter Header) headers. The MQHeader node does not modify the message body.

The Java code that is used by the node is stored in an Eclipse Java project.

This sample shows how you can use the MQMD header to manipulate an incoming message to enable a WebSphere MQ application to understand the message. The sample also shows how an MQMD header can be added to, or removed from, an incoming message by using an MQHeader node.

This sample demonstrates a flow by placing an integration node between a Web service client and a server. An HTTP message is passed to a WebSphere MQ application by adding an MQMD header to an MQHeader node. A JavaCompute node is used to save the HTTP state. The processed message is passed through the flow in which a JavaCompute node is used to restore the saved HTTP state and an MQHeader node is used to remove the MQMD header, before forwarding the message to an HTTPReply node.

The following message flow is imported by the sample:

A screen capture of the MQHeader Node message flow

The flow works in the following way:

  1. An HTTP message is sent to the following Web address: http://localhost:7080/isPrime
  2. The flow receives the HTTP message on an HTTPInput node (GetHTTPMessage).
  3. The message is passed to a JavaCompute node (SaveHTTPState) to store the request identifier of the HTTP message. The request identifier is stored in the body of the HTTP message.
  4. The message is passed to an MQHeader node (AddMQHeader), which adds the MQMD header property (Format) to the message. The message is stored in a queue by using an MQOutput node (StoreInMQ).
  5. The WebSphere MQ application reads the message from the queue by using an MQInput node (ReadFromMQ).
  6. The message is passed to a JavaCompute node (PrimeCheck), which checks the input message to see whether the number received is a prime number. The resulting message is stored in the queue by using an MQOutput node (SaveResult).
  7. The result of the WebSphere MQ application is read by an MQInput node (ReadResult).
  8. The message is passed to a JavaCompute node (RestoreHTTPState) to restore the HTTP request identifier from the message.
  9. The output message from the JavaCompute node is passed to an MQHeader node (RemoveMQHeader) to remove the WebSphere MQ headers.
  10. The output message from the MQHeader node is passed to an HTTPReply node (HTTPReplyResult).

The WebSphere MQ queues

The following WebSphere MQ queues are created by the sample:

Back to sample home