Header Ads Widget

Responsive Advertisement

Connecting to IBM WebSphere MQ in Java


Connecting to IBM WebSphere MQ (now known as IBM MQ) in Java involves using the IBM MQ Java client libraries. Below are the steps and an example code to establish a connection to IBM MQ.

Step 1: Add IBM MQ Client Library

Make sure you have the IBM MQ client JAR files. If you're using Maven, you can add the dependency for the IBM MQ client.

Add the following dependency to your pom.xml:

xml

<dependency>

    <groupId>com.ibm.mq</groupId>

    <artifactId>com.ibm.mq.allclient</artifactId>

    <version>9.2.0.0</version>

</dependency>

 

Step 2: Connection Configuration

Define the connection configuration parameters such as the queue manager name, channel, connection name (host and port), user, and password.

Step 3: Establish Connection and Send/Receive Messages

Here’s an example Java code to connect to IBM MQ, put a message on a queue, and then get a message from the queue:

java

import com.ibm.mq.MQException;

import com.ibm.mq.constants.CMQC;

import com.ibm.mq.MQQueue;

import com.ibm.mq.MQQueueManager;

import com.ibm.mq.MQPutMessageOptions;

import com.ibm.mq.MQGetMessageOptions;

import com.ibm.mq.MQMessage;

 

public class MQExample {

    public static void main(String[] args) {

        String host = "localhost";

        int port = 1414;

        String channel = "SYSTEM.DEF.SVRCONN";

        String queueManagerName = "QM1";

        String queueName = "QUEUE1";

        String user = "yourUser";

        String password = "yourPassword";

 

        MQQueueManager queueManager = null;

 

        try {

            // Set the MQ connection properties

            com.ibm.mq.MQEnvironment.hostname = host;

            com.ibm.mq.MQEnvironment.port = port;

            com.ibm.mq.MQEnvironment.channel = channel;

            com.ibm.mq.MQEnvironment.userID = user;

            com.ibm.mq.MQEnvironment.password = password;

 

            // Initiate a connection with the QueueManager.

            queueManager = new MQQueueManager(queueManagerName);

 

            // Clarify which queue we would like to open and specify the options available for that action.

            int openOptions = CMQC.MQOO_INPUT_AS_Q_DEF | CMQC.MQOO_OUTPUT;

 

            // Kindly identify the queue we intend to open and outline the options for doing so.

            MQQueue queue = queueManager.accessQueue(queueName, openOptions);

 

            // Create a message

            MQMessage putMessage = new MQMessage();

            putMessage.writeString("Hello, World!");

 

            // Specify the message options object

            MQPutMessageOptions pmo = new MQPutMessageOptions();

 

            // Insert the message into the queue.

            queue.put(putMessage, pmo);

            System.out.println("Message sent to queue: " + queueName);

 

            // Get the message from the queue

            MQGetMessageOptions gmo = new MQGetMessageOptions();

            MQMessage getMessage = new MQMessage();

            queue.get(getMessage, gmo);

            String messageText = getMessage.readStringOfByteLength(getMessage.getMessageLength());

            System.out.println("Message received from queue: " + messageText);

 

            // Close the queue

            queue.close();

 

        } catch (MQException mqe) {

            System.out.println("There was an issue with WebSphere MQ. " +

                               mqe.completionCode + " Reason code " + mqe.reasonCode);

        } catch (java.io.IOException ex) {

            System.out.println("An IOException occurred whilst writing to the message buffer: " + ex);

        } finally {

            if (queueManager != null) {

                try {

                    queueManager.disconnect();

                } catch (MQException mqe) {

                    System.out.println("There was an issue with WebSphere MQ whilst disconnecting: Completion code " +

                                       mqe.completionCode + " Reason code " + mqe.reasonCode);

                }

            }

        }

    }

}

 

 

Explanation

  1. Dependencies:
    • Ensure you have the IBM MQ client JAR files in your classpath. If using Maven, include the dependency as shown above.
  2. Connection Properties:
    • com.ibm.mq.MQEnvironment.hostname, com.ibm.mq.MQEnvironment.port, com.ibm.mq.MQEnvironment.channel, com.ibm.mq.MQEnvironment.userID, and com.ibm.mq.MQEnvironment.password are used to set the connection properties for the MQ environment.
  3. Queue Manager and Queue:
    • MQQueueManager queueManager = new MQQueueManager(queueManagerName); establishes a connection to the specified queue manager.
    • MQQueue queue = queueManager.accessQueue(queueName, openOptions); opens the specified queue with the given options.
  4. Message Handling:
    • Create a message using MQMessage.
    • Set message content using putMessage.writeString("Hello, World!");.
    • Put the message on the queue using queue.put(putMessage, pmo);.
    • Get the message from the queue using queue.get(getMessage, gmo);.
  5. Exception Handling:
    • Handle exceptions such as MQException and IOException.
  6. Clean Up:
    • Ensure that the queue and queue manager are properly closed and disconnected in the finally block.

 


 

More Example

Step 1

package com.kartik.pie;

public class DemoData {

 private String name;
 private String description;
 private double data;
 public String getName() {
  return name;
 }
 public void setName(String name) {
  this.name = name;
 }
 public String getDescription() {
  return description;
 }
 public void setDescription(String description) {
  this.description = description;
 }
 public double getData() {
  return data;
 }
 public void setData(double data) {
  this.data = data;
 }

}

 

Step 2

package com.mq.in;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;

import javax.jms.BytesMessage;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.ObjectMessage;
import javax.jms.Queue;
import javax.jms.QueueBrowser;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.StreamMessage;
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import com.ibm.mq.MQEnvironment;
import com.ibm.mq.MQException;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQQueueManager;
import com.ibm.mq.constants.CMQC;
import com.ibm.mq.jms.MQMessageConsumer;
import com.ibm.mq.jms.MQQueue;
import com.ibm.mq.jms.MQQueueConnection;
import com.ibm.mq.jms.MQQueueConnectionFactory;
import com.ibm.mq.jms.MQQueueReceiver;
import com.ibm.mq.jms.MQQueueSender;
import com.ibm.mq.jms.MQQueueSession;
import com.ibm.msg.client.wmq.WMQConstants;

public class QueueHandler extends Thread{
 private ReceiveMessageProcessor rcvMsgProc;
 private SendMessageProcessor sendMsgProc;
 public static MQQueueConnectionFactory connectionFactory = null;
 public static MQQueueConnection connection = null;
 public static MQQueueSession receiveSession = null;
 public static MQQueueReceiver queueReceiver = null;
 public static MQQueueSession sendSession = null;
 public static MQQueueSender queueSender =  null;
 public static MessageConsumer mqmessage=null;
 
 public static boolean isRollBack = false;
 
 public static boolean isConnected =  false;
 
 final public static int NO_ERROR = 0;
 final public static int ERROR_MQ_FULL = -1;
 public static String[] pad = {"", "0", "00", "000", "0000"};
 int openOptions = CMQC.MQOO_INQUIRE + CMQC.MQOO_FAIL_IF_QUIESCING + CMQC.MQOO_INPUT_SHARED;


 public QueueHandler(boolean isSend) {
  rcvMsgProc = new ReceiveMessageProcessor();
  sendMsgProc = new SendMessageProcessor();
  isConnected = false;
  initialize(isSend);
 }
 
 public void initialize(boolean isSend) {
  try {
    connectionFactory = new MQQueueConnectionFactory();
    if (connectionFactory != null) {
     connectionFactory.setHostName("localhost");
     connectionFactory.setPort(1414);
     connectionFactory.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_BINDINGS);
     connectionFactory.setQueueManager("QM_IN_MANDALKC_1");
     //connectionFactory.setChannel("SYSTEM.DEF.SVRCONN");
     transferDataFromOneQueueToAnotherQueue(isSend);
    }
  } catch (JMSException e) {
   System.out.println("Establish an error within the configuration settings for the message queue:"
                            + e.getMessage());
  } catch (Exception e) {
   System.out.println("Establish an error within the configuration settings for the message queue:"
                    + e.getMessage());
  } catch (Throwable t) {
   System.out.println("Establish an error within the configuration settings for the message queue:"
                    + t.getMessage());
  }
 }
 
 private void transferDataFromOneQueueToAnotherQueue(boolean isSend) {
  if (!isConnected) {
   try{
    connection = (MQQueueConnection) connectionFactory.createQueueConnection();
    System.out.println("Channel : "+connectionFactory.getChannel());
    //create the queue receiver INQUEUE
    receiveSession = (MQQueueSession) connection.createQueueSession(isSend, Session.AUTO_ACKNOWLEDGE);
    //Source queue name mention name here
    MQQueue receiveQueue = (MQQueue) receiveSession.createQueue("rbbactivationadvisory");
    queueReceiver = (MQQueueReceiver)receiveSession.createReceiver(receiveQueue);
    //create the queue sender DESTQUE
    if(true) {
     sendSession = (MQQueueSession) connection.createQueueSession(isSend, Session.AUTO_ACKNOWLEDGE);
     //destination queue name mention name here
     MQQueue sendQueue = (MQQueue) sendSession.createQueue("mdbrejectqueue");
     queueSender =  (MQQueueSender) sendSession.createSender(sendQueue);
    }
    connection.start();
    isConnected = true;
   } catch (JMSException e) {
    System.out.println("connectToMQ Connection to MQ Failed: "+ e.getMessage());
    isConnected = false;
   } catch (Exception e) {
    System.out.println("connectToMQ Connection to MQ Failed: "+ e.getMessage());
    isConnected = false;
   } catch (Throwable t) {
    System.out.println("connectToMQ Connection to MQ Failed: "+ t.getMessage());
    isConnected = false;
         }
   
  }
 }
 
 
 /*public String getMessageFromMq(MQQueueReceiver receiver) {
 
  TextMessage msgFromMq = null;
  String  rcvdMsg = null;

  try {
   msgFromMq = (TextMessage) QueueHandler.queueReceiver.receive();
   rcvdMsg = msgFromMq.getText();
   System.out.println("SessionHandler.getMessageFromMq(): Msg -->>" + rcvdMsg);
   boolean isValidMsg = rcvMsgProc.validateReceivedMessage(rcvdMsg);
   boolean isSent;
   if(isValidMsg){
    isSent = sendHarrierMsgToMQ(rcvdMsg);
    QueueHandler.receiveSession.commit();
    QueueHandler.sendSession.commit();
    System.out.println("The message was sent to the destination and has been successfully committed. ");
   }else{
    System.out.println("inside else part of the getMessageFromMq");
    QueueHandler.receiveSession.commit();
    return null;
   }
  } catch (Exception e) {
   System.out.println("getMessageFromMq Receiving Message From MQ Failed: "
                        + (e.getMessage() == null ? "" : e.getMessage()));
   QueueHandler.cleanUp();
  } catch (Throwable t) {
   System.out.println("getMessageFromMq Receiving Message From MQ Failed: "
                    + (t.getMessage() == null ? "" : t.getMessage()));
   QueueHandler.cleanUp();
  }
 
   if(rcvdMsg == null) {
   return null;
  }
 
  return rcvdMsg.toString();
 }*/
 
 
public String getMessageFromMq(MQQueueReceiver receiver) {
 
  Message msgFromMq = null;
  String  rcvdMsg = null;
  try {
   msgFromMq = (Message) QueueHandler.queueReceiver.receive();
   rcvdMsg=jmsMessageBodyAsString(msgFromMq);
   System.out.println("SessionHandler.getMessageFromMq(): Msg -->>" + rcvdMsg);
   boolean isValidMsg = rcvMsgProc.validateReceivedMessage(rcvdMsg);
   boolean isSent;
   if(isValidMsg){
    isSent = sendHarrierMsgToMQ(rcvdMsg);
    QueueHandler.receiveSession.commit();
    QueueHandler.sendSession.commit();
    System.out.println("The message was sent to the destination and has been successfully committed. ");
   }else{
    System.out.println("inside else part of the getMessageFromMq");
    QueueHandler.receiveSession.commit();
    return null;
   }
  } catch (Exception e) {
   System.out.println("getMessageFromMq Receiving Message From MQ Failed: "
                        + (e.getMessage() == null ? "" : e.getMessage()));
   QueueHandler.cleanUp();
  } catch (Throwable t) {
   System.out.println("getMessageFromMq Receiving Message From MQ Failed: "
                    + (t.getMessage() == null ? "" : t.getMessage()));
   QueueHandler.cleanUp();
  }
 
   if(rcvdMsg == null) {
   return null;
  }
 
  return rcvdMsg.toString();
 }
 
 public boolean sendHarrierMsgToMQ(String data) {
 
  if (!QueueHandler.isConnected) {
   return false;
  }
 
  if(data == null) {
   return false;
  }
 
  data = sendMsgProc.defineMessageForSending(data);
 
  if (QueueHandler.sendSession != null) {
   try {
    System.out.println(data);
    System.out.println("inside try block of sendHarrierMsgToMQ");
    TextMessage commandMessage = (TextMessage) sendSession.createTextMessage(data);
    QueueHandler.queueSender.send(commandMessage);
    QueueHandler.sendSession.commit();
   } catch (JMSException jmsEx) {
    try {
     QueueHandler.receiveSession.rollback();
    } catch (JMSException e1) {
     e1.printStackTrace();
    }
    System.out.println("inside catch block of sendHarrierMsgToMQ");
    Exception linkedEx = jmsEx.getLinkedException();
    if (linkedEx != null) {
     String msg = linkedEx.getMessage();
     if (msg != null && msg.indexOf("2053") != -1
       && msg.indexOf("MQRC_Q_FULL") != -1) {
      System.out.println(msg + " :MQ Send Queue is full."); //console log
      try {
       Thread.sleep(1000);
      } catch (InterruptedException e) {
      
      }
      return false;
     }
    }
   
    QueueHandler.cleanUp();
    return false;
   } catch (Exception e) {
    QueueHandler.cleanUp();
    return false;
   } catch (Throwable t) {
    QueueHandler.cleanUp();
    return false;
   }
  } else {
   System.out.println("sendHarrierMsgToMQ(): MQ connection closed. Please check logs.");
   return false;
  }
 
  return true;
 }
 /**
  * This is the
  */
 public void run() {
  String harrierMsg = null;
 
  Thread t1 = new Thread(new ReceiveMessageProcessor());
  t1.start();
 
  Thread t2 = new Thread(new SendMessageProcessor());
  t2.start();
 
  while (true) {
   try {
    if (QueueHandler.queueReceiver != null) {
     QueueHandler.isRollBack = false;
    }
    System.out.println("MQ is waiting to receive/send messages.............");
    harrierMsg = this.getMessageFromMq(QueueHandler.queueReceiver);//this is actually transfer
   
    if(harrierMsg != null) {
     if (harrierMsg.length() == 0) {
      System.out.println("Link.run(): Non-byte message(s) received.");
      continue;
     }
    } else {
     try {
      Thread.sleep(1000);
     } catch (InterruptedException e) {
     }
    }
   } catch (Exception e) {
    e.printStackTrace();
    System.out.println(e.getMessage());
    try {
     Thread.sleep(1000);
    } catch (InterruptedException e1) {
    }
   } catch (Throwable throwable) {
    throwable.printStackTrace();
    System.out.println(throwable.getMessage());
    try {
     Thread.sleep(1000);
    } catch (InterruptedException e1) {
    }
   }
  } //end while
 
 }
 
 /**
  *
  * Gracefully close MQ connection.
  */
 private static void cleanUp() {
  if (queueSender != null) {
   try {
    queueSender.close();
   } catch (Exception e) {
   } catch (Throwable t) {
   }
   queueSender = null;
  }
  if (sendSession != null) {
   try {
    sendSession.close();
   } catch (Exception e) {
   } catch (Throwable t) {
   }
   sendSession = null;
  }
  if (queueReceiver!= null) {
   try {
    queueReceiver.close();
   } catch (Exception e) {
   } catch (Throwable t) {
   }
   queueReceiver = null;
  }
  if (receiveSession != null) {
   try {
    receiveSession.close();
   } catch (Exception e) {
   } catch (Throwable t) {
   }
   receiveSession = null;
  }
  if (connection != null) {
   try {
    connection.close();
   } catch (Exception e) {
   } catch (Throwable t) {
   }
   connection = null;
  }
  connectionFactory = null;
  isConnected = false;
 }
 
 public static void main(String[] args) {
  new QueueHandler(true).start();
 }
 
 
 
 
 /**
     * Return a string description of the type of JMS message
     */
    static String messageType(Message messge) {

        if (messge instanceof TextMessage) {
            return "TextMessage";
        } else if (messge instanceof BytesMessage) {
            return "BytesMessage";
        } else if (messge instanceof MapMessage) {
            return "MapMessage";
        } else if (messge instanceof ObjectMessage) {
            return "ObjectMessage";
        } else if (messge instanceof StreamMessage) {
            return "StreamMessage";
        } else if (messge instanceof Message) {
            return "Message";
        } else {
            // Unknown Message type
            String type = messge.getClass().getName();
            StringTokenizer st = new StringTokenizer(type, ".");
            String s = null;
            while (st.hasMoreElements()) {
                s = st.nextToken();
            }
            return s;
        }
    }

    /**
     * Generate a string representation of the body of a JMS bytes message, effectively

* producing a hex dump of the body. Please be aware that this operation focuses solely

* on the first 1K of the message body.

     */
    private static String jmsMessageBodyAsString(Message messge) {
        byte[] body = new byte[1024];
        int n = 0;

        if (messge instanceof BytesMessage) {
            try {
                ((BytesMessage)messge).reset();
                n = ((BytesMessage)messge).readBytes(body);
            } catch (JMSException ex) {
                return (ex.toString());
            }
/*
BytesMessage bm = (BytesMessage) messge;
                byte data[] = new byte[(int) bm.getBodyLength()];
                bm.readBytes(data);
                return new String(data);
*/

        } else if (messge instanceof StreamMessage) {
            try {
                ((StreamMessage)messge).reset();
                n = ((StreamMessage) messge).readBytes(body);
            } catch (JMSException ex) {
                return (ex.toString());
            }
        }

        if (n <= 0) {
            return "<empty body>";
        } else {
            return(toHexadecimalDump(body, n) +
                   ((n >= body.length ) ? "\n. . ." : "") );
        }
    }

    /**
     * Generate a string that represents the content of a JMS message body.
     */
    private static String jmsMessageBodyAsString(Message messge) {

        if (messge instanceof TextMessage) {
            try {
                return ((TextMessage) messge).getText();
            } catch (JMSException ex) {
                return ex.toString();
            }
        } else if (messge instanceof BytesMessage) {
            return jmsBytesBodyAsString(messge);
        } else if (messge instanceof MapMessage) {
            MapMessage msg = (MapMessage) messge;
            HashMap props = new HashMap();
            // Extract every property from MapMessage and compile them into a hash table.
            try {
                for (Enumeration enu = msg.getMapNames();
                    enu.hasMoreElements();) {
                    String name = (enu.nextElement()).toString();
                    props.put(name, (msg.getObject(name)).toString());
                }
                return props.toString();
            } catch (JMSException ex) {
                return (ex.toString());
            }
        } else if (messge instanceof ObjectMessage) {
            ObjectMessage msg = (ObjectMessage) messge;
            Object obj = null;
            try {
                obj = msg.getObject();
                if (obj != null) {
                    return obj.toString();
                } else {
                    return "null";
                }
            } catch (Exception ex) {
                return (ex.toString());
            }
        } else if (messge instanceof StreamMessage) {
            return jmsBytesBodyAsString(m);
        } else if (messge instanceof Message) {
            return " It is not possible to obtain the body for the message designated as Message. ";
        }
        return "Unknown message type " + messge;
    }

    /**
     * Acquires the JMS header fields from a JMS message and maps them into a HashMap.

     */
    private static HashMap jmsHeadersToHashMap(Message messge) throws JMSException {
        HashMap hdrs = new HashMap();
        String s = null;

        s = messge.getJMSCorrelationID();
        hdrs.put("JMSCorrelationID", s);

        s = String.valueOf(m.getJMSDeliveryMode());
        hdrs.put("JMSDeliverMode", s);

        Destination d = messge.getJMSDestination();
        if (d != null) {
            if (d instanceof Queue) {
                s = ((Queue)d).getQueueName();
            } else {
                s = ((Topic)d).getTopicName();
            }
        } else {
            s = "";
        }
        hdrs.put("JMSDestination", s);

        s = String.valueOf(messge.getJMSExpiration());
        hdrs.put("JMSExpiration", s);

        s = messge.getJMSMessageID();
        hdrs.put("JMSMessageID", s);

        s = String.valueOf(messge.getJMSPriority());
        hdrs.put("JMSPriority", s);

        s = String.valueOf(messge.getJMSRedelivered());
        hdrs.put("JMSRedelivered", s);

        d = messge.getJMSDestination();
        if (d != null) {
            if (d instanceof Queue) {
                s = ((Queue)d).getQueueName();
            } else {
                s = ((Topic)d).getTopicName();
            }
        } else {
            s = "";
        }
        hdrs.put("JMSReplyTo", s);

        s = String.valueOf(messge.getJMSTimestamp());
        hdrs.put("JMSTimestamp", s);

        s = messge.getJMSType();
        hdrs.put("JMSType", s);

        return hdrs;
    }
 
 
 
    /**
     * This method takes a buffer of bytes and outputs a hexadecimal representation. Each hex digit denotes 4 bits, and the digits are formatted into sets of 4, corresponding to 2 bytes or 16 bits. Each line features 8 groups, amounting to 128 bits per line.

     */
    private static String toHexadecimalDump(byte[] buffer, int length) {

        // Buffer must be an even length
        if (buffer.length % 2 != 0) {
            throw new IllegalArgumentException();
        }

  int value;
  StringBuffer sb = new StringBuffer(buffer.length * 2);

  /* Assume the buffer is structured in network byte order, meaning the most significant byte is at

* buffer[0]. Convert the two pairs of bytes into a short and then represent it as a hex string.
   */
  int n = 0;
  while (n < buffer.length && n < length) {
      value = buffer[n + 1] & 0xFF;    // Lower byte
      value |= (buffer[n] << 8) & 0xFF00;  // Upper byte
            String s = Integer.toHexString(value);
            // Left bad with 0's
      sb.append(pad[4 - s.length()]);
            sb.append(s);
      n += 2;

            if (n % 16 == 0) {
                sb.append("\n");
            }  else {
                sb.append(" ");
            }
         }
   return sb.toString();
    }
 
 
    public static List<MqPojo> detailsOfList(){
     List<MqPojo> mqPojoLst=new ArrayList<MqPojo>();
     MqPojo mqPojo=new MqPojo();
     mqPojo.setMqName("mdbrejectqueue");
     mqPojo.setMqType("Local");
     mqPojoLst.add(mqPojo);
  return mqPojoLst;
    }
}

 

An in-depth implementation for a message queue (MQ) handler using IBM WebSphere MQ (IBM MQ). It consists of functionality to connect to an MQ server, receive and send messages between queues, handle various message types, and process message headers.

Here’s a summary of the main features and some optimizations for clarity and error-handling:

Main Features:

  1. MQ Connection Setup: The initialize method sets up the connection factory with the MQ server, host, port, and queue manager.
  2. Message Transfer: The transferDataFromOneQueueToAnotherQueue method establishes sessions and consumers for the source queue and producers for the destination queue.
  3. Receiving Messages: The getMessageFromMq method retrieves messages from the source queue, validates, and optionally sends them to the destination queue after calling sendHarrierMsgToMQ.
  4. Sending Messages: The sendHarrierMsgToMQ method sends validated messages to the destination queue and handles MQ-specific errors.
  5. Message Conversion and Processing: Helper methods like jmsMsgBodyAsString, jmsBytesBodyAsString, and jmsHeadersToHashMap convert various message types (e.g., TextMessage, BytesMessage, MapMessage) to a string format for easier processing.
  6. Thread Management: The run method launches threads for ReceiveMessageProcessor and SendMessageProcessor to manage message flow concurrently.
  7. Error Handling and Cleanup: The cleanUp method ensures that MQ resources like sessions and connections are closed properly if an error occurs or when the application shuts down.

 

 

Conclusion

This example demonstrates how to connect to IBM MQ, put a message on a queue, and retrieve a message from the queue using Java. This provides a basic foundation for interacting with IBM MQ from Java applications. 

 



Webspher MQ connection
Webspher MQ connection 







Post a Comment

0 Comments