|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
java program to get a message from queue |
« View previous topic :: View next topic » |
Author |
Message
|
mahek |
Posted: Tue Jan 04, 2005 9:18 am Post subject: java program to get a message from queue |
|
|
Voyager
Joined: 10 Sep 2004 Posts: 87
|
Hi all,
Can any one help me with a java program that gets a message from a queue from a paticular queue manager |
|
Back to top |
|
 |
JT |
Posted: Tue Jan 04, 2005 9:52 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
|
Back to top |
|
 |
mahek |
Posted: Wed Jan 05, 2005 6:52 am Post subject: |
|
|
Voyager
Joined: 10 Sep 2004 Posts: 87
|
Hi JT,
Thanks a lot for the help i was abel to find the program in the link you mentioned.
bye |
|
Back to top |
|
 |
sanyasirajumandapati |
Posted: Thu Jan 06, 2005 8:21 am Post subject: |
|
|
Novice
Joined: 20 Dec 2004 Posts: 14
|
import com.ibm.mq.*;
import java.io.*;
public class a2
{
public static void main(String args[])throws MQException,java.io.IOException
{
MQEnvironment.hostname = "mirdev184";//host name
MQEnvironment.channel = "sunny";//server connection channel
MQEnvironment.port=1415;//port of the queuemanager
MQQueueManager qMgr = new MQQueueManager("qmgr");
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF|MQC.MQOO_OUTPUT|MQC.MQOO_INQUIRE|MQC.MQOO_SET;
MQQueue system_default_local_queue =qMgr.accessQueue("q1",openOptions,null,null,null);
int d=system_default_local_queue.getCurrentDepth();
System.out.println("appQ Depth is:"+d+" (Before Picking)" );
MQMessage retrievedMessage = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
system_default_local_queue.get(retrievedMessage, gmo);
String msgText = retrievedMessage.readUTF();
System.out.println("The message is: " + msgText);
d=system_default_local_queue.getCurrentDepth();
System.out.println("appQ Depth is:"+d+" (After Picking)");
system_default_local_queue.close();
qMgr.disconnect();
}
} _________________ SUNNY |
|
Back to top |
|
 |
kirani |
Posted: Thu Jan 06, 2005 5:52 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Please post Java related questions into Java forum
[Moving to Java/JMS forum] _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|