Ejemplo n.º 1
0
 /**
  * Returns the collection queue enumeration constant that corresponds to the given name.
  *
  * @param queueName The collection queue name.
  * @return The queue enumeration constant or null if no constant exists for the name.
  */
 public static MQQueue fromQueueName(String queueName) {
   for (MQQueue queue : values()) {
     if (queue.getQueueName().equals(queueName)) {
       return queue;
     }
   }
   return null;
 }
Ejemplo n.º 2
-1
  public static void main(String args[]) {
    try {
      MQEnvironment.hostname = "192.168.43.187";
      MQEnvironment.port = 1414;
      MQEnvironment.channel = "mymgrChannel";

      //            MQEnvironment.hostname = "10.10.10.93";
      //            MQEnvironment.port = 1415;
      //            MQEnvironment.channel = "ESBQManagerChannel";

      MQEnvironment.userID = "kirishanthy";
      MQEnvironment.password = "******";
      MQQueueManager qMgr = new MQQueueManager(qManager);
      int openOptions = MQConstants.MQOO_OUTPUT;
      MQQueue queue = qMgr.accessQueue(qName, openOptions);
      for (int i = 0; i < 1000; i++) {
        MQMessage msg = new MQMessage();
        //                String message = "this message from mymgr";
        String message = MQClientUtils.DEFAULT_PLACEORDER_PAYLOAD;
        msg.writeUTF(message);
        MQPutMessageOptions pmo = new MQPutMessageOptions();
        queue.put(msg, pmo);
      }
      queue.close();
      qMgr.disconnect();
    } catch (MQException ex) {
      ex.printStackTrace();
      System.out.println(
          "A WebSphere MQ Error occurred : Completion Code "
              + ex.completionCode
              + " Reason Code "
              + ex.reasonCode);

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