ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » java program to get a message from queue

Post new topic  Reply to topic
 java program to get a message from queue « View previous topic :: View next topic » 
Author Message
mahek
PostPosted: Tue Jan 04, 2005 9:18 am    Post subject: java program to get a message from queue Reply with quote

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
View user's profile Send private message
JT
PostPosted: Tue Jan 04, 2005 9:52 am    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

Take a look at the MQ sample programs at: http://www.developer.ibm.com/tech/sampmq.html

Specifically mqbrowse.java.
Back to top
View user's profile Send private message
mahek
PostPosted: Wed Jan 05, 2005 6:52 am    Post subject: Reply with quote

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
View user's profile Send private message
sanyasirajumandapati
PostPosted: Thu Jan 06, 2005 8:21 am    Post subject: Reply with quote

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
View user's profile Send private message
kirani
PostPosted: Thu Jan 06, 2005 5:52 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » java program to get a message from queue
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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.