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 API Support » Get message one after the other ?

Post new topic  Reply to topic
 Get message one after the other ? « View previous topic :: View next topic » 
Author Message
bhu
PostPosted: Fri Jul 28, 2006 11:38 am    Post subject: Get message one after the other ? Reply with quote

Novice

Joined: 27 Jun 2006
Posts: 19

How to get messages from the Queue one after the other in a loop.
is there any property which tell if there more messages?

i want to connect to the Queue and get all the messages save it to a file or database untill all the message are read.
if there is a failure it needs to skip that message and go to the next.
using .NET

Please let me know
thanks
bhu
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Jul 28, 2006 2:09 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Yes, you can do this using .NET.

By writing a program in the .NET programming language.

Most any programmer who knows the .NET programming language, the MQ API, and how to write to a file or insert into a database can do this.

Which of those four things are you asking us to provide you free training or free source code for?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bhu
PostPosted: Mon Jul 31, 2006 5:51 am    Post subject: Reply with quote

Novice

Joined: 27 Jun 2006
Posts: 19

I have already programmed to read the queue and write to a File.
but the problem is i am able to read only one at a time, i don;t the command to ask the Queue if there are more messages ?

Here is my code for for the read, as of now i just want to read one by one. once done i will be passsing the string to another fuction which will write to a file
, As u can see i am doing a disconnect, which i don't want to do instead get the next message, and also if there is problem skip to next message.
I am new to MQ.
thanks
bhu

queueManger = new MQQueueManager(QueueManagerName,channelName,connectionName);
queue = queueManger.AccessQueue(QueueName,MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING );
queueMessage = new MQMessage();
queueMessage.Format = MQC.MQFMT_STRING;

MQGetMessageOptions oGetMsgOption = new MQGetMessageOptions();

oGetMsgOption.Options = MQC.MQPMO_SYNCPOINT;
queue.Get(queueMessage,oGetMsgOption);
queueManger.Commit();
queue.Close();
queueManger.Disconnect();
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jul 31, 2006 5:56 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

1st Clue:

bhu wrote:

queueManger = new MQQueueManager(QueueManagerName,channelName,connectionName);
queue = queueManger.AccessQueue(QueueName,MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING );
queueMessage = new MQMessage();
queueMessage.Format = MQC.MQFMT_STRING;

MQGetMessageOptions oGetMsgOption = new MQGetMessageOptions();

oGetMsgOption.Options = MQC.MQPMO_SYNCPOINT;
queue.Get(queueMessage,oGetMsgOption);
queueManger.Commit();
queue.Close();
queueManger.Disconnect();


You might find that asks the queue if there are more messages, in the same way it asks if there was a first one........

2nd Clue:

Look up loops in any reliable programming manual. Or indeed any of the MQ manuals or sample code!!!!
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Get message one after the other ?
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.