Author |
Message
|
Yars13 |
Posted: Fri Oct 01, 2004 1:35 pm Post subject: syncpoint question |
|
|
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 |
|
 |
vennela |
Posted: Fri Oct 01, 2004 1:52 pm Post subject: |
|
|
 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 |
|
 |
bower5932 |
Posted: Sat Oct 02, 2004 6:44 pm Post subject: |
|
|
 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 |
|
 |
zpat |
Posted: Sun Oct 03, 2004 5:13 am Post subject: |
|
|
 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 |
|
 |
kirani |
Posted: Sun Oct 03, 2004 12:11 pm Post subject: |
|
|
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 |
|
 |
Yars13 |
Posted: Sun Oct 03, 2004 5:10 pm Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Sun Oct 03, 2004 6:44 pm Post subject: |
|
|
 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 |
|
 |
Yars13 |
Posted: Mon Oct 04, 2004 11:09 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Mon Oct 04, 2004 11:38 am Post subject: |
|
|
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 |
|
 |
Yars13 |
Posted: Mon Oct 04, 2004 12:03 pm Post subject: |
|
|
Novice
Joined: 27 Sep 2004 Posts: 21
|
|
Back to top |
|
 |
bower5932 |
Posted: Mon Oct 04, 2004 12:54 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
|
Back to top |
|
 |
vennela |
Posted: Mon Oct 04, 2004 12:59 pm Post subject: |
|
|
 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 |
|
 |
BOBD |
Posted: Mon Oct 04, 2004 6:06 pm Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Mon Oct 04, 2004 7:12 pm Post subject: |
|
|
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 |
|
 |
kirani |
Posted: Mon Oct 04, 2004 11:03 pm Post subject: |
|
|
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 |
|
 |
|