Author |
Message
|
NewbeeMQ |
Posted: Tue Feb 17, 2004 2:17 pm Post subject: An Interesting question about MQ Get Message |
|
|
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 |
|
 |
bower5932 |
Posted: Tue Feb 17, 2004 2:53 pm Post subject: |
|
|
 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 |
|
 |
jefflowrey |
Posted: Tue Feb 17, 2004 2:54 pm Post subject: |
|
|
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 |
|
 |
NewbeeMQ |
Posted: Wed Feb 18, 2004 7:36 am Post subject: |
|
|
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 |
|
 |
bower5932 |
Posted: Wed Feb 18, 2004 8:06 am Post subject: |
|
|
 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 |
|
 |
PeterPotkay |
Posted: Wed Feb 18, 2004 3:54 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
It is qmgr.Backout. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
NewbeeMQ |
Posted: Thu Feb 19, 2004 7:12 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Thu Feb 19, 2004 7:33 am Post subject: |
|
|
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 |
|
 |
bob_buxton |
Posted: Fri Feb 20, 2004 3:12 am Post subject: |
|
|
 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 |
|
 |
PeterPotkay |
Posted: Fri Feb 20, 2004 5:39 am Post subject: |
|
|
 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 |
|
 |
|