|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
![Reply to topic](templates/DAJ_Glass/images/lang_english/reply.gif) |
|
WMQ.Net and TransactionScope |
« View previous topic :: View next topic » |
Author |
Message
|
Qetza |
Posted: Tue May 19, 2009 1:11 am Post subject: WMQ.Net and TransactionScope |
|
|
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 |
|
![](templates/DAJ_Glass/images/spacer.gif) |
WMBDEV1 |
Posted: Tue May 19, 2009 1:34 am Post subject: |
|
|
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 |
|
![](templates/DAJ_Glass/images/spacer.gif) |
WMBDEV1 |
Posted: Tue May 19, 2009 1:42 am Post subject: |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
Qetza |
Posted: Tue May 19, 2009 6:24 am Post subject: |
|
|
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.
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 |
|
![](templates/DAJ_Glass/images/spacer.gif) |
Vitor |
Posted: Tue May 19, 2009 6:28 am Post subject: |
|
|
![](images/avatars/905340816499abc1cdfb07.jpg) Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 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 |
|
![](templates/DAJ_Glass/images/spacer.gif) |
|
|
![Reply to topic](templates/DAJ_Glass/images/lang_english/reply.gif) |
|
Page 1 of 1 |
|
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
|
|
|
|