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 » between non-destructive & destructive read

Post new topic  Reply to topic
 between non-destructive & destructive read « View previous topic :: View next topic » 
Author Message
mk.gupta
PostPosted: Mon Aug 07, 2006 7:30 am    Post subject: between non-destructive & destructive read Reply with quote

Novice

Joined: 27 Mar 2006
Posts: 13
Location: CA, US

I am new to MQ. i am able to acheive a non destructive browse & destructive read on comment #1 & #2 on code below. Can i do a unit of work (db update) in between the two? what care should i take? Do i need to reset CORREL_ID? How to ensure the same message is deleted on succesful DB insertion?


qMgr= new MQQueueManager(qManager);

int openOptions = MQC.MQOO_BROWSE | MQC.MQOO_INPUT_AS_Q_DEF;

MQQueue system_default_local_queue1 = qMgr.accessQueue("U.SLICE.OUTPUT", openOptions);
MQMessage retrievedMessage =new MQMessage();


MQGetMessageOptions gmo =new MQGetMessageOptions();

//#1get message by non - destructive browse -
gmo.options = MQC.MQGMO_NO_WAIT | MQC.MQGMO_FAIL_IF_QUIESCING | MQC.MQGMO_BROWSE_FIRST;

// after non destructive get, the message is parsed to form a SQL, for some DB insertion.
//on successful insertion, same message is to removed by following destructive read

//#2perform destructive read as follow
gmo.options = MQC.MQMO_MATCH_CORREL_ID |MQC.MQGMO_NO_WAIT | MQC.MQGMO_FAIL_IF_QUIESCING | MQC.MQGMO_SYNCPOINT;


// get the message off the queue..

system_default_local_queue1.get(retrievedMessage,gmo);


// Close the queue.
system_default_local_queue1.close();

// Disconnect from the queue manager.
qMgr.disconnect();


Thanks ,
Manish
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Aug 07, 2006 7:47 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Those are simple questions with very complex answers that depend a lot on the exact circumstances of your set-up, what you're trying to achieve, how you're coding, etc, etc. Whole chapters of documentation attempt to answer them and there's been a lot of posting on this forum. I recommend absolutely that you put some reading time in - this is not straightforward and is surprisingly easy to muck up!

To point you in the right direction by answering your questions:

1) Yes you can, if you set it up right. Look up syncpoint & XA transaction co-ordination.

2) A lot. Particually with the cofiguration of external participants and the positioning of the unit of work.

3) CORREL_ID has nothing to do with it. If you think it does, read the docs again. And again.

4) See 1 above. If the message read is in the same unit of work as the db activity the transaction co-ordinator will sort it out automatically, provided it's set-up and coded correctly

Happy Reading
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » between non-destructive & destructive read
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.