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 IndexIBM MQ API SupportUsing .Net TransactionScope with IBM XMS

Post new topicReply to topic
Using .Net TransactionScope with IBM XMS View previous topic :: View next topic
Author Message
SeverinP
PostPosted: Wed Aug 17, 2016 4:57 am Post subject: Using .Net TransactionScope with IBM XMS Reply with quote

Newbie

Joined: 17 Aug 2016
Posts: 1

Can I use TransactionScope when access IBM MQ with XMS? I have this test code:

Code:
 var context =
               new InitialContext(
                   new Hashtable
                   {
                        { "XMSC_IC_URL", "XXX" },
                        { "XMSC_IC_SECURITY_AUTHENTICATION", "none" },
                   });

                var connectionFactory = (IConnectionFactory) context.Lookup("XXX");
                    connectionFactory.SetStringProperty("XMSC_WMQ_CONNECTION_MODE", "5");
                    connectionFactory.SetStringProperty("XMSC_WMQ_SSL_CIPHER_SPEC", "TRIPLE_DES_SHA_US");
                    connectionFactory.SetStringProperty("XMSC_WMQ_SSL_KEY_REPOSITORY", "XXX");

                try
                {
                    using (var scope = new TransactionScope())
                    {
                        using (var connection = connectionFactory.CreateConnection())
                        {
                            connection.Start();
                            using (var session = connection.CreateSession(true, AcknowledgeMode.SessionTransacted))
                            {
                                using (var queue = session.CreateQueue(queueName))
                                {
                                    using (var consumer = session.CreateConsumer(queue))
                                    {
                                        var message = consumer.Receive();
                                    }
                                }
                            }
                        }

                        throw new Exception();
                    }
                }
                catch (Exception)
                {
                }


It will commit recieving (acknowledge) of the message despite of exception. Why? If I comment line "using (var scope = new TransactionScope())" then the message will remain in the queue.
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 IndexIBM MQ API SupportUsing .Net TransactionScope with IBM XMS
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.