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 IndexMultiphase CommitWMQ.Net and TransactionScope

Post new topicReply to topic
WMQ.Net and TransactionScope View previous topic :: View next topic
Author Message
Qetza
PostPosted: Tue May 19, 2009 1:11 am Post subject: WMQ.Net and TransactionScope Reply with quote

Newbie

Joined: 19 May 2009
Posts: 2

Hello,
I'm currently using Client connection mode.
I would like to know how i can use TransactionScope for WMQ read/write only and WMQ and Oracle read/write ?

I'm using WMQ with .Net 2.0 client applications. The WMQ servers not Windows (AIX i think).

I've tried a simple example to write a message to a queue with a TransactionScope around it but even if i don't call Complete the message is send :

Code:

var managerOptions = new Hashtable();
managerOptions[MQC.CHANNEL_PROPERTY] = "MYCHANNEL";
managerOptions[MQC.HOST_NAME_PROPERTY] = "a.b.c.d";
managerOptions[MQC.PORT_PROPERTY] = 1416;

var queueManager = new MQQueueManager("MYQUEUEMANAGER", managerOptions);
var queue = queueManager.AccessQueue(
  "MYQUEUE",
  MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_OUTPUT
  );

using (var ts = new TransactionScope())
{
  var message = new MQMessage();
  message.WriteString("test");

  var options = new MQPutMessageOptions();
  options.Options |= MQC.MQPMO_FAIL_IF_QUIESCING | MQC.MQPMO_SYNCPOINT;

  queue.Put(message, options);
}

queue.Close();
queueManager.Disconnect();


Anyone can help on those 2 scenarios ? (installation type, configuration, ...)

Thanks,
Guillaume
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Tue May 19, 2009 1:34 am Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

I'm not a .net developer but I fail to see how adding the transaction scope will make mq commit or backout the message, how would it know which command to execute?

Why dont you use commit or backout methods on the queue manager object?

According to the .net docs....
http://msdn.microsoft.com/en-us/library/ms172152.aspx
the resource manager (MQ in this case) must be a "System.Transactions" resource manager do you know if this is so?

This should tell us if what you are trying to do is possible or not.
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Tue May 19, 2009 1:42 am Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

I've had a quick read of the MQ .net redbook:

http://www.redbooks.ibm.com/redbooks/pdfs/sg247012.pdf

and this does not mention the approach that you are using.

Have a read of chapter 13 which discusses transactions.
Back to top
View user's profile Send private message
Qetza
PostPosted: Tue May 19, 2009 6:24 am Post subject: Reply with quote

Newbie

Joined: 19 May 2009
Posts: 2

Hello,

Quote:
I'm not a .net developer but I fail to see how adding the transaction scope will make mq commit or backout the message, how would it know which command to execute?


In .Net when the TransactionScope goes out of scope, if the Complete method was not called on it, the transaction is rolledback; otherwise it is committed. As you mention, this mecanism only works if MQ supports the System.Transactions resource manager mechanism. Part of my question was also to know if it does.

Quote:
I've had a quick read of the MQ .net redbook:

http://www.redbooks.ibm.com/redbooks/pdfs/sg247012.pdf

and this does not mention the approach that you are using.


I've done a quick read and it doesn't mention TransactionScope approch but these classes where introduced in .Net 2.0 and i'm not sure the file is up to date.

Thanks for the answers,
Guillaume
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue May 19, 2009 6:28 am Post subject: Reply with quote

Grand High Poobah

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

Qetza wrote:
As you mention, this mecanism only works if MQ supports the System.Transactions resource manager mechanism. Part of my question was also to know if it does.


My .NET is almost as poor as my Java, but typically WMQ will only participate in externally coordinated transactions if it's running server side or is using the ETC rather than the standard client.
_________________
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 topicReply to topic Page 1 of 1

MQSeries.net Forum IndexMultiphase CommitWMQ.Net and TransactionScope
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.