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 » syncpoint question

Post new topic  Reply to topic Goto page 1, 2  Next
 syncpoint question « View previous topic :: View next topic » 
Author Message
Yars13
PostPosted: Fri Oct 01, 2004 1:35 pm    Post subject: syncpoint question Reply with quote

Novice

Joined: 27 Sep 2004
Posts: 21

i'm new with this so bear with me here.

From the description i got in the MQ using .Net manual, when you use the MQC.MQGMO_SYNCPOINT option, the message is marked as being unavailable to other applications, but is is deleted from the queue only when the unit of work committed.

So what happens if the application crashes before it is committed? Is the message still marked as unavailable when i come back and try to get it again? if so, how do i get around that?

Thanks in advance,

Yars
Back to top
View user's profile Send private message
vennela
PostPosted: Fri Oct 01, 2004 1:52 pm    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

If your app crashes then the message will be made available to others including your app
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bower5932
PostPosted: Sat Oct 02, 2004 6:44 pm    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

If your app happens to be client connected, you may need to wait for the agent that is running on the qmgr to time out before the message becomes available. However, this is simply timing. The message isn't lost.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
zpat
PostPosted: Sun Oct 03, 2004 5:13 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

The backout count in the MQMD is incremented.

Therefore you should inspect this value immediately after a MQGET under syncpoint to avoid a backout loop. When the count exceeds a certain value, you should move the message to an error queue, rather than attempt to process it.

Bear in mind with multiple client programs, the message you get may have already been backed out by another program, so you should use the backout count stored in the message and not an internal counter.
Back to top
View user's profile Send private message
kirani
PostPosted: Sun Oct 03, 2004 12:11 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Ideally backout count on the message should be compared with backout threshold property on the queue itself.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
Yars13
PostPosted: Sun Oct 03, 2004 5:10 pm    Post subject: Reply with quote

Novice

Joined: 27 Sep 2004
Posts: 21

ok now you guys have lost me. I'm connecting through a client. What i want to do is get a message from the queue, formatt it somehow in my code, then add it to the database. I dont want the message to be deleted from the queue until the database has been updated. I'm using MQSeries 5.3, C# and SQL server.

If my application crashes or my connection to the database is down or anything that could happen that will stop me from completing the entire process, how long would i have to wait before i can try to get the message from the queue again? Can i set this time somehow?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Oct 03, 2004 6:44 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Retry timing is immediate. You rollback the message to the queue, you get the message again on the next read. If you are unable to process the message more than say 3 times (this should take care of most locking problems) you have a "poison message". Read up on the programming manuals

Enjoy
Back to top
View user's profile Send private message Send e-mail
Yars13
PostPosted: Mon Oct 04, 2004 11:09 am    Post subject: Reply with quote

Novice

Joined: 27 Sep 2004
Posts: 21

another question: Can i do the syncpoint option for a PUT? So if i put a message on the queue, then need to update my database, then only commit only after the DB has been updated. Does it mean that until i commit, the message will not be available for anyone to pick up? and if something happens before the commit, does it mean that the message will not be added to the queue?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Oct 04, 2004 11:38 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Yars13 wrote:
another question: Can i do the syncpoint option for a PUT? So if i put a message on the queue, then need to update my database, then only commit only after the DB has been updated. Does it mean that until i commit, the message will not be available for anyone to pick up? and if something happens before the commit, does it mean that the message will not be added to the queue?


Yes. You can build a transaction that includes {MQGet, SQL statements, MQPut}.

BUT! What you are talking about is now a two-phase transaction, between MQ and a database.

This gets more complicated. You now need to use something as a transactional coordinator - and what that is depends on your environment. And you also have to do stuff with your code to support it.

There are sample two-phase commit programs available.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Yars13
PostPosted: Mon Oct 04, 2004 12:03 pm    Post subject: Reply with quote

Novice

Joined: 27 Sep 2004
Posts: 21

thanks, i did a search for two-phase commits and found an example for java and i'm sure i can translate that into C#. If anyone is interested here is the link http://www.developer.ibm.com/tech/sample_code_handler.pl?action=display&object=/tech/sample_code/mq/mqdb2log.java

Yars
Back to top
View user's profile Send private message
bower5932
PostPosted: Mon Oct 04, 2004 12:54 pm    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

This link:

http://www.developer.ibm.com/tech/sampmq.html

will drop you on the list of all of the WMQ sample code that is available from that site.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
vennela
PostPosted: Mon Oct 04, 2004 12:59 pm    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Yars13 wrote:
ok now you guys have lost me. I'm connecting through a client.


If you are client connecting then 2-phace commit is not available. Either you need to use bindings mode or use Extended transactional client.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
BOBD
PostPosted: Mon Oct 04, 2004 6:06 pm    Post subject: Reply with quote

Novice

Joined: 01 Oct 2004
Posts: 12

I am writing similar program using C# and 5.3 client. After reading IBM documentation my understanding is that two phase commit is available
through COM+/MTS. Here is the link how to create COM+ component
http://support.microsoft.com/default.aspx?scid=kb;en-us;816141
You will have to also set MQC.MQPMO_SYNCPOINT on MQPutMessageOptions


You can use transactional client if you don’t want to use distributed transaction coordinator.
Let me know if you have any questions.
Thanks, Bob
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Oct 04, 2004 7:12 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

BOBD wrote:
I am writing similar program using C# and 5.3 client. After reading IBM documentation my understanding is that two phase commit is available
through COM+/MTS.


This is very very likely to be wrong.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
kirani
PostPosted: Mon Oct 04, 2004 11:03 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Well, MTS can act as a Transaction Coordinator. In his case MQ and SQL Server DB will act as Resource managers within the same transaction.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ API Support » syncpoint question
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.