Anonymous,

Please Login or Register
Download Nuke Evolution today for a CMS you can enjoy using and sharing with your friends!

[ Download Now ]
Main Menu   
 
HomeHome  
    Home
Members  
    Profile
    Your Account
Community  
    Forums
Statistics  
    Statistics
    Top 10
Files & Links  
    Downloads
News  
    News
Other  
    Tutorials
    Content
    FAQ
    Site Map
Search   
 


Forum Index  ·  Search  ·  Usergroups  ·  Edit your profile  ·  Members  ·  Login, Check Messages
Arcade  ·  Ranks  ·  Staff  ·  Statistics  ·  Board Rules  ·  Forum FAQ  ·  Log in

Search for at
David Welford-Costelloe Forums Advanced Search


   
Recent Topics   Next 6 >>  
 Forum   Author   Replies   Last Post 
Ubuntu - Free Linux Operating System Linux Distros dcostelloe 1 Sun Apr 22, 2012 9:09 pm
dcostelloe View latest post
Free ASP NET Wiki - Open Source Open Source dcostelloe 0 Sun Mar 18, 2012 2:12 pm
dcostelloe View latest post
SpiceWorks It Support Open Source Open Source dcostelloe 0 Sat Mar 17, 2012 12:49 pm
dcostelloe View latest post
What I am doing today Chat dcostelloe 0 Mon Feb 20, 2012 8:49 pm
dcostelloe View latest post
Common Error with Biztalk file loading Enterprise Service Bus dcostelloe 0 Wed Jan 25, 2012 6:39 pm
dcostelloe View latest post
Create PDF using Big Faceless Java PDF Library Java LewisIngram 0 Mon Dec 19, 2011 12:17 pm
LewisIngram View latest post

Tutorial Using Java Swing to Connect to WebSphere

 
Post new topic    Reply to topic    printer-friendly view    David Welford-Costelloe Forums Forum Index -> Java
View previous topic :: View next topic  
Author Message
dcostelloe
Major-General
Major-General



Gender: Gender:Male
Joined: May 28, 2011
Age: 51
Posts: 206
Location: Burlington, Ontario
Reputation: 52
canada.png


Status: Offline
PostPosted: Sun May 29, 2011 2:02 am Post subject: Important Tutorial Using Java Swing to Connect to WebSphere Reply with quote

This code is a sample of writing a Java Swing GUI to send and receive messages from WebSphere MQ 6.0.


Code:
/**
    * Send Message to WMQ
    */
   public void processRequest() {
      String sRequestManager = null;
      String sRequestQueue = null;

      for (PropertiesClass oList : arList) {
         sRequestManager = oList.getRequestQManager();
         sRequestQueue = oList.getRequestQueueName();
      }
      try {
         // Create a connection to the queue manager
         requestQMgr = new MQQueueManager(sRequestManager);

         // Set options
         int iOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;

         // Open queue and set options
         requestQueue = requestQMgr.accessQueue(sRequestQueue, iOptions,
               null, null, null);
         // Build Message
         MQMessage send_msg = new MQMessage();
         // Get the message from the jTextArea
         send_msg.writeUTF(textAreaMessage.getText().trim());
         // Set the options
         MQPutMessageOptions pmo = new MQPutMessageOptions();
         // put the message on the queue
         requestQueue.put(send_msg, pmo);
         // Close the Queue
         requestQueue.close();
         // Disconnect from the queue manager
         requestQMgr.disconnect();
         setFonts(false, "Message has been placed on the Queue "
               + sRequestQueue + " With Message of: "
               + textAreaMessage.getText());

      } catch (MQException ex) {
         // MQ Error
         System.out.println("An MQSeries error occurred : Completion code "
               + ex.completionCode + " Reason code " + ex.reasonCode);
         setFonts(true, "An MQException error: Completion code "
               + ex.completionCode + " Reason code " + ex.reasonCode);

      }
      // Buffer Error?
      catch (java.io.IOException ex) {
         System.out
               .println("An error occurred while writing to the message buffer: "
                     + ex);
         setFonts(true,
               "An error occurred while writing to the message buffer: "
                     + ex);
      }

   }
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:
Post new topic  Reply to topic   printer-friendly view David Welford-Costelloe Forums Forum Index ->  Java Time synchronized with your computer time
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum




Powered by phpBB © 2001, 2006 phpBB Group
EvoXtreme Theme by SgtLegend ©
Forums ©