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 » An Interesting question about MQ Get Message

Post new topic  Reply to topic
 An Interesting question about MQ Get Message « View previous topic :: View next topic » 
Author Message
NewbeeMQ
PostPosted: Tue Feb 17, 2004 2:17 pm    Post subject: An Interesting question about MQ Get Message Reply with quote

Newbie

Joined: 13 Feb 2004
Posts: 5

Hi,

My environment is VB6.0, IBM Mqseries.

Once I read a message from MQ Queue, what will happen to
that message. Will it be deleted automatically or locked?

My requriement is once I get a Certificate Number from the
MQ Message I need to query the database. If something messed up
with my application and If I need to get the message againg from MQ queue, is it possible? If so once I successfully read the message how can I get the next message?

My code is:

Dim qMgr As MQQueueManager
Dim mqSess As New MQSession
Dim inputMsg As New MQMessage
Dim inputOptions As New MQGetMessageOptions
Dim mqRequestQueue As MQQueue

Set qMgr = mqSess.AccessQueueManager(gsMqQMgrName)
Set mqRequestQueue = qMgr.AccessQueue(gsMqRequestQueue, _
MQOO_INPUT_AS_Q_DEF + _
MQOO_FAIL_IF_QUIESCING + _
MQOO_INQUIRE)

inputOptions.Options = MQGMO_WAIT + _
MQGMO_CONVERT

inputOptions.WaitInterval = 5000

inputQueue.Get inputMsg, inputOptions

With inputMsg
sCertNo = .ReadString(4)
End With

Any help can be greately appreciated.

Thanks,
Suresh
Back to top
View user's profile Send private message
bower5932
PostPosted: Tue Feb 17, 2004 2:53 pm    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

It sounds like you need to get your message under syncpoint. If everything works fine, you commit. If you run into an error, you rollback and try again. There are details in the Application Programming Guide and Reference.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
jefflowrey
PostPosted: Tue Feb 17, 2004 2:54 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You should read the chapters in the Application Programming Guide that discuss getting messages, both with the browse option and with syncpoints.

This will help you understand which approach is better for your particular situation, and how you have to go about both setting up your code and your environment to do what you need it to do.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
NewbeeMQ
PostPosted: Wed Feb 18, 2004 7:36 am    Post subject: Reply with quote

Newbie

Joined: 13 Feb 2004
Posts: 5

How can I rollback if I want to read the message again.
I cant see any rollback option. I can see only COMMIT option.

I am setting the following options before reading the message.

inputOptions.Options = MQGMO_WAIT + MQGMO_CONVERT + MQGMO_FAIL_IF_QUIESCING + MQGMO_COMPLETE_MSG + MQGMO_SYNCPOINT + MQGMO_LOGICAL_ORDER

If I want to roll back again what options I need to set again.
I am new to this MQSeries. I am really confused. Please bear with me.

Suresh
Back to top
View user's profile Send private message
bower5932
PostPosted: Wed Feb 18, 2004 8:06 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

I'm not a VB person, so I can't tell you where it is. In C, you would either issue MQCMIT or MQBACK. I'm guessing that VB has a qmgr.commit and qmgr.back?
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
PeterPotkay
PostPosted: Wed Feb 18, 2004 3:54 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

It is qmgr.Backout.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
NewbeeMQ
PostPosted: Thu Feb 19, 2004 7:12 am    Post subject: Reply with quote

Newbie

Joined: 13 Feb 2004
Posts: 5

If Queue Manager has 2 or 3 queues and if I want to rollback only one queue is it possible?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Feb 19, 2004 7:33 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

JeffLowrey wrote:
You should read the chapters in the Application Programming Guide that discuss getting messages, both with the browse option and with syncpoints.

_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bob_buxton
PostPosted: Fri Feb 20, 2004 3:12 am    Post subject: Reply with quote

Master

Joined: 23 Aug 2001
Posts: 266
Location: England

NewbeeMQ wrote:
If Queue Manager has 2 or 3 queues and if I want to rollback only one queue is it possible?

No, Rollback effects a entire Unit of work, all queues, databases and other transctional resources.

You could simulate the rollback of a single message by putting (under syncpoint) the message back onto the queue.

Or as has already been suggested you could browse the message with lock and only destructively get it when you are sure that it won't need to be rolled back.
_________________
Bob Buxton
Ex-Websphere MQ Development
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Fri Feb 20, 2004 5:39 am    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

What if you create 3 separate qmgr objects, and open up each queue in its own qmgr object?

qmgr1 opens up QueueA
qmgr2 opens up QueueB
qmgr3 opens up QueueC

All the queues are actually on the same QM.

I can't test it out myself right now, but will issuing qmgr1.backout only rollback the transaction that qmgr1 handled, leaving the others as is.
_________________
Peter Potkay
Keep Calm and MQ On
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 » An Interesting question about MQ Get Message
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.