views:

24

answers:

1

I develop in C# using MQ v.7 native API.

I would like to use syncpoints to guarantee data consistency but can't find any code samples on how to use them.

I will be using local units of work. OS is Windows.

Can anyone share some links or code snippets on using Commit() and Backout() in C#?

+1  A: 

Unfortunately, the samples that come with WMQ do not syncpoint operations. Instead, take a look at Chapter 13.1.2 in the WebSphere MQ Solutions in a Microsoft .NET Environment Redbook. The code snippets there show syncpoint and can be integrated into the samples that are installed with WMQ.

If you are not on WMQ V7, please upgrade. The .Net support has been greatly enhanced and integrated into the base product. Furthermore, WMQ v6.x is end-of-life as of September 2011 and you will need to be on v7 at that point to obtain support. The WMQ V7 client can be downloaded as SupportPac MQC7.

T.Rob
Thanks, this is exactly what I was looking for. Can you clarify one thing for me though? Say I want to include 2 MQ messages (messages are sent out) in single transaction. Should I use mqPutMsgOpts.Options=MQC.MQPMO_SYNCPOINT;for each message or just for the first one?Thanks.
Joe Schmoe
Use the syncpoint option for each GET or PUT that needs to be in the transaction, then COMMIT. It is possible to mix GET and PUT of messages both inside and outside of the transaction by selectively omitting the syncpoint option.
T.Rob