Hi all: The download page of MA88 supportpak say:MQSeries classes for Java The MQSeries classes for Java allow a program written in the Java programming language to connect to MQSeries as an MQSeries client using TCP/IP, or directly to an MQSeries server using the Java Native Interface (JNI). They allow Java applets, applications, and servlets access to the messaging and queuing services of MQSeries. If the client-style connection is used, no additional MQSeries code is required on the client machine. The MQSeries classes for Java enable a message-based approach to application integration using Java.
This mean that the resources of mq.jar are sufficients in order to use this classes from servlet or jsp? I want to say, to development a thread safe component. Thanks in advance, Ulises. Zerbe John W <[EMAIL PROTECTED]> wrote:Please note, you shouldn't use the MQEnvironment.xxx variables to set your connection info in an application server. They are Static and hence shared by all threads. There is another constructor for the MQQueueManager that takes a Hashtable as a parm that contains your connection info: MQQueueManager(String queueManagerName,java.util.Hashtable properties) This one is thread safe. http://www-3.ibm.com/software/ts/mqseries/library/manualsa/manuals/crosslatest.html Look at the "WebSphere MQ Using Java" for more details. The constructors are described in chapter 9. -----Original Message----- From: Shah, Urvesh (CAP, GEFA Contractor) [mailto:[EMAIL PROTECTED]] Sent: Friday, January 17, 2003 2:37 PM To: [EMAIL PROTECTED] Subject: Re: Jps(or Servlet) with MQ-SERIES in windows NT. Hi Ulises, Attached herewith is a sample Java application that PUTs a message to an MQ queue and then reads and displays the same. Replace the parameters with your own as indicated in the sample. You will need "mq.jar" and/or "mqjms.jar" if you intend to use JMS too. You can get these jar files from the MA88 supportPak from IBM for MQSeries. ======================================== import com.ibm.mq.*; // Include the MQ package public class MQSample { private String hostname = ""; // define the name of your host to connect to private String channel = ""; // define name of channel for client to use private int port = 1414; // Note. assumes MQ Server is listening on // the default TCP/IP port of 1414 private String qManager = ""; // define name of queue manager object to // connect to. private MQQueueManager qMgr; // define a queue manager object // When the class is called, this initialisation is done first. public MQSample() { // Set up MQ environment MQEnvironment.hostname = hostname; // Could have put the hostname & channel MQEnvironment.channel = channel; // string directly here! MQEnvironment.port = port; try { qMgr = new MQQueueManager(qManager); } catch (Exception ex) { System.out.println("Error in connecting the q manager...."); } } public static void main(String args[]) { try { // Create a connection to the queue manager // Set up the options on the queue we wish to open... // Note. All MQ Options are prefixed with MQC in Java. MQSample mqsamp = new MQSample(); int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT ; // Now specify the queue that we wish to open, and the open options... MQQueue dss_reply_queue = mqsamp.qMgr.accessQueue("", openOptions, "", "", ""); // default q manager // no dynamic q name // no alternate user id // Define a simple MQ message, and initialise it in UTF format.. MQMessage hello_world = new MQMessage(); hello_world.writeUTF("Hello World!"); // specify the message options... MQPutMessageOptions pmo = new MQPutMessageOptions(); // accept the defaults, same // as MQPMO_DEFAULT constant // put the message on the queue dss_reply_queue.put(hello_world,pmo); // get the message back again... // First define a MQ message buffer to receive the message into.. MQMessage retrievedMessage = new MQMessage(); retrievedMessage.messageId = hello_world.messageId; // Set the get message options.. MQGetMessageOptions gmo = new MQGetMessageOptions(); // accept the defaults // same as MQGMO_DEFAULT // get the message off the queue.. dss_reply_queue.get(retrievedMessage, gmo, 100); // max message size // And prove we have the message by displaying the UTF message text String msgText = retrievedMessage.readUTF(); System.out.println("The message is: " + msgText); // Close the queue dss_reply_queue.close(); // Disconnect from the queue manager mqsamp.qMgr.disconnect(); } // If an error has occured in the above, try to identify what went wrong. // Was it an MQ error? catch (MQException ex) { System.out.println("An MQ error occurred : Completion code " + ex.completionCode + " Reason code " + ex.reasonCode); } // Was it a Java buffer space error? catch (java.io.IOException ex) { System.out.println("An error occurred whilst writing to the message buffer: " + ex); } } // end of main } // end of MQSample ======================================== I hope this helps! Best regards, Urvesh. x 4119. -----Original Message----- From: uli uu [mailto:[EMAIL PROTECTED]] Sent: Friday, January 17, 2003 8:52 AM To: [EMAIL PROTECTED] Subject: Jps(or Servlet) with MQ-SERIES in windows NT. Hello to all: I need to connect a java component (jsp or servlet) with an application by Mq-Series (the application provides a mq-series interface), but I don't know what is necessary to make this connection. Does somebody have an example in order to make the connection? I'm working in Windows NT 4.0, with tomcat. Please any aid I thank for them, since it's an urgent subject. Thank you very much, Ulises. --------------------------------- Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com DISCLAIMER: The information contained in this e-mail may be confidential and is intended solely for the use of the named addressee. Access, copying or re-use of the e-mail or any information contained therein by any other person is not authorized. If you are not the intended recipient please notify us immediately by returning the e-mail to the originator. ==========================================================================To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com --------------------------------- Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com