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 Java / JMS » MQ Transactions ?

Post new topic  Reply to topic
 MQ Transactions ? « View previous topic :: View next topic » 
Author Message
harshvajra
PostPosted: Sun Feb 03, 2008 8:44 pm    Post subject: MQ Transactions ? Reply with quote

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
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Sun Feb 03, 2008 10:15 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
harshvajra
PostPosted: Sun Feb 03, 2008 10:44 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Mon Feb 04, 2008 12:53 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Mon Feb 04, 2008 3:19 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
harshvajra
PostPosted: Tue Feb 05, 2008 3:39 am    Post subject: MQ Transactions ? Reply with quote

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
View user's profile Send private message Send e-mail
Vitor
PostPosted: Tue Feb 05, 2008 3:48 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Tue Feb 05, 2008 11:27 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » MQ Transactions ?
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.