Author |
Message
|
harshvajra |
Posted: Sun Feb 03, 2008 8:44 pm Post subject: MQ Transactions ? |
|
|
 Apprentice
Joined: 23 Apr 2007 Posts: 46 Location: India
|
Hello all,
A part of the requirement is to do a destructive get of the msg's from queue and write it to a file.
The architecture is Client-Server.
The client is do the above mentioned job.
Now the messages are in size of 128KB-512KB(kilobytes), when the msg is get it is writing to a file, but when it is in the process of getting and n/w goes down i'm loosing the message.
The requirement is with mq connection resume support, i.e when the comm is up it sgould start writing to the file from next message.
How to make sure there is no loss of msg(it must be either written to file/must be in the queue)
The requirement is being done in MQjava.
I've read about the MQQueueManager transaction methods:
like commit(),backout() and begin().
can any one quide me..
thanks in advance. _________________ Failure is not a defeat,it's just a delay, Walk TALL |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Feb 03, 2008 10:15 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Did you use the syncpoint option in the put?
Transaction handling might look simplified to you if you are familiar with JMS.
Just remember that a file is never under transactional control and nothing is really written until the buffer is flushed...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
harshvajra |
Posted: Sun Feb 03, 2008 10:44 pm Post subject: |
|
|
 Apprentice
Joined: 23 Apr 2007 Posts: 46 Location: India
|
Hello,
I am making sure the buffer is flushed and file is closed before the application exit's to write to a file,
I have checked the get message options
MQC.MQGMO_SYNCPOINT
now can i implement this to make sure there is no loss of data
try{
for(int i=0;i<queueDepth;i++){
queue.get(..);
qmgr.commit();
}
} catch(MQException e){
qmgr.backout();
}
but i doubt will the rollback be complete or only at the time of exception of a particulat message... _________________ Failure is not a defeat,it's just a delay, Walk TALL |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 04, 2008 12:53 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
harshvajra wrote: |
only at the time of exception of a particulat message... |
_________________ I am *not* the model of the modern major general.
Last edited by jefflowrey on Mon Feb 04, 2008 6:04 am; edited 1 time in total |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Feb 04, 2008 3:19 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Using queue depth is a very poor design option for you.
You should check the return and reason code and loop until you get a 2033. For more explanations search the forum. It has been discussed many times.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
harshvajra |
Posted: Tue Feb 05, 2008 3:39 am Post subject: MQ Transactions ? |
|
|
 Apprentice
Joined: 23 Apr 2007 Posts: 46 Location: India
|
MQ is loosing messages.
The application is developed in MQ Java, JDK1.4.1, MQ Server 5.3 CSD 12 and MQ Client 5.3 CSD 11 all on windows env.
In a client-server architecture, the mq api does not allow us to begin a transaction, which is allowed in binding mode(srv-srv) if im not wrong.
But the option to get message MQC.MQGMO_SYNCPOINT is of no use for my requirement.
The app does a destructive get of msg from queue and writes to file
during one of the MQGET the MQRC 2009 occurs, then where does the msg go ?
Even after setting the "MQC.MQGMO_SYNCPOINT " the code
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_FAIL_IF_QUIESCING;
gmo.options = MQC.MQGMO_NONE;
gmo.options = MQC.MQMDS_FIFO+MQC.MQGMO_SYNCPOINT;
while(int_TotalMsgInQueue!=0){
inMQMsg.clearMessage();
inMQMsg.messageId = MQC.MQCI_NONE;
inMQMsg.correlationId = MQC.MQMI_NONE;
try{
dataQueue.get(inMQMsg, gmo);
vocQmgr.commit();
}catch(MQException e0){
vocQmgr.backout();
writer.doLog("Getting The Data Message : Failed");
does not save the msg.
How to save msg from getting lost in client-server arc... _________________ Failure is not a defeat,it's just a delay, Walk TALL |
|
Back to top |
|
 |
Vitor |
Posted: Tue Feb 05, 2008 3:48 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
First off, previous posters have told you not to use queue depth (TotalMsgInQ) as a loop. It's a bad design and will cause problems. I can envisage a scenario where it's causing this one.
Secondly, how are you determining that the messages are "lost"? Do you mean that the next application to do a get isn't presented with it (which is not the same thing)? Have you checked the queue, and looked for outstanding units of work? Are there log messages? Are the messages persistent (and I don't mean the default persistence of the putting queue, I mean the persistence of the messages)?
AFAIK the client supports trasnactions. What it doesn't support are externally coordinated transactions.
Thirdly, upgrade to v6. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Feb 05, 2008 11:27 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You do not analyze the MQException... Where are the completion code and the reason code??? in your output  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|