View previous topic :: View next topic
|
Author |
Message |
Susan Talbot
New User
Joined: 17 Dec 2010 Posts: 36 Location: KY
|
|
|
|
I wrote an MQ program that does a commit every 9999 messages (because the queue manager has max uncommitted messages set to 10000).
I am looping thru a file, putting each record on the queue and I get to 9999 and then commit. Then say I am on record 11000 and something fails. I issue a rollback and the program ends. I look in the queue and there are 9999 messages. I can see why this happens, since a MQCMIT makes the messages permanent but I don't know what to do. If we restart the job it will put the first 9999 back on the queue again which would be very bad.
How do we either delete the messages or restart at record 10000? I want to know how MQ can do this for me but I am not seeing anything in the manual. Anyone know? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Is this a dedicated queue or do multiple processes put info in thes queue?
If the queue is only for this process, suggest you empty the queue when this process begins and then there will be no need to restart "in the middle". |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Follow on:
Keep in mind that the whoe reason for the COMMIT is to make sure theings that are "done" are NOT rolled back. . .
There would be no reason to ever commit if the content would automatically be rolled back. . . |
|
Back to top |
|
|
Susan Talbot
New User
Joined: 17 Dec 2010 Posts: 36 Location: KY
|
|
|
|
The only reason I do the commit is because of the max uncommitted messages limit. 9999 messages is not my 'unit of work' an entire file is my unit of work but we have been told the limit cannot be raised. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Understood, but the queston remains - does anything other than this process use this particular queue? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
1. are you using RRSAF?
Normally, one would keep a counter,
or better still load the file into a db2 table.
this would be your unit of work- fetch from db2 cursor
- delete from db2 cursor
- PUT to MQS
- commit(based on fetch/delete/put count)
when you start your program, open cursor and start your loop
or
keep a counter in memory - read from file
- put to mqs
- add 1 to counter
- commit on cycle / write counter to a second file
when you start the program read the second file,
if it is empty start from begining of first file
if not empty, save counter, close first file.
read second file number of counter times,
start your loop.
or
you can keep the counter in yet another db2 table.
but to use db2, you need to make an attachment to rrsaf.
this kind of stuff should be in your site standards. |
|
Back to top |
|
|
|