/// <summary>
        /// Initializes the <see cref="IDequeueMessages" />.
        /// </summary>
        /// <param name="address">The address to listen on.</param>
        /// <param name="transactionSettings">The <see cref="TransactionSettings" /> to be used by <see cref="IDequeueMessages" />.</param>
        /// <param name="tryProcessMessage">Called when a message has been dequeued and is ready for processing.</param>
        /// <param name="endProcessMessage">Needs to be called by <see cref="IDequeueMessages" /> after the message has been processed regardless if the outcome was successful or not.</param>
        public void Init(Address address, TransactionSettings transactionSettings, Func<TransportMessage, bool> tryProcessMessage, Action<TransportMessage, Exception> endProcessMessage)
        {
            this.tryProcessMessage = tryProcessMessage;
            this.endProcessMessage = endProcessMessage;
            this.workQueue = this.NamePolicy.GetQueueName(address);
            this.clientInfo = string.Format("OracleAQDequeueStrategy for {0}", this.workQueue);

            this.transactionOptions = new TransactionOptions
            {
                IsolationLevel = transactionSettings.IsolationLevel,
                Timeout = transactionSettings.TransactionTimeout,
            };

            this.dequeueOptions = new OracleAQDequeueOptions
            {
                DequeueMode = OracleAQDequeueMode.Remove,
                ProviderSpecificType = true,
                Wait = 0,
            };

            if (this.PurgeOnStartup)
            {
                this.Purger.Purge(this.workQueue);
            }
        }
Esempio n. 2
0
        void IsTransactional(TransactionSettings transactionSettings)
        {
            #region 5to6IsTransactional

            bool isTransactional = transactionSettings.IsTransactional;

            #endregion
        }
Esempio n. 3
0
        void SuppressDistributedTransactions(TransactionSettings transactionSettings)
        {
            #region 5to6SuppressDistributedTransactions

            bool suppressDistributedTransactions = transactionSettings.SuppressDistributedTransactions;

            #endregion
        }
 public NativeTransactionReceiveStrategy(string connectionString, TableBasedQueue errorQueue, Func<TransportMessage, bool> tryProcessMessageCallback, PipelineExecutor pipelineExecutor, TransactionSettings transactionSettings)
 {
     this.pipelineExecutor = pipelineExecutor;
     this.tryProcessMessageCallback = tryProcessMessageCallback;
     this.errorQueue = errorQueue;
     this.connectionString = connectionString;
     isolationLevel = GetSqlIsolationLevel(transactionSettings.IsolationLevel);
 }
 public NativeTransactionReceiveStrategy(string connectionString, TableBasedQueue errorQueue, Func<TransportMessage, bool> tryProcessMessageCallback, ConnectionFactory sqlConnectionFactory, IConnectionStore connectionStore, TransactionSettings transactionSettings)
 {
     this.tryProcessMessageCallback = tryProcessMessageCallback;
     this.errorQueue = errorQueue;
     this.connectionString = connectionString;
     this.sqlConnectionFactory = sqlConnectionFactory;
     this.connectionStore = connectionStore;
     isolationLevel = GetSqlIsolationLevel(transactionSettings.IsolationLevel);
 }
 public void Init(Address address, 
     TransactionSettings transactionSettings, 
     Func<TransportMessage, bool> tryProcessMessage, 
     Action<TransportMessage, Exception> endProcessMessage)
 {
     this.tryProcessMessage = tryProcessMessage;
     this.endProcessMessage = endProcessMessage;
     endpointAddress = address;
 }
Esempio n. 7
0
 /// <summary>
 /// Creates an instance of <see cref="TransportReceiver"/>
 /// </summary>
 /// <param name="transactionSettings">The transaction settings to use for this <see cref="TransportReceiver"/>.</param>
 /// <param name="maximumConcurrencyLevel">The maximum number of messages to process in parallel.</param>
 /// <param name="maximumThroughput">The maximum throughput per second, 0 means unlimited.</param>
 /// <param name="receiver">The <see cref="IDequeueMessages"/> instance to use.</param>
 /// <param name="manageMessageFailures">The <see cref="IManageMessageFailures"/> instance to use.</param>
 /// <param name="settings">The current settings</param>
 /// <param name="config">Configure instance</param>
 public TransportReceiver(TransactionSettings transactionSettings, int maximumConcurrencyLevel, int maximumThroughput, IDequeueMessages receiver, IManageMessageFailures manageMessageFailures, ReadOnlySettings settings, Configure config)
 {
     this.settings = settings;
     this.config = config;
     TransactionSettings = transactionSettings;
     MaximumConcurrencyLevel = maximumConcurrencyLevel;
     MaximumMessageThroughputPerSecond = maximumThroughput;
     FailureManager = manageMessageFailures;
     Receiver = receiver;
 }
Esempio n. 8
0
 /// <summary>
 /// Creates an instance of <see cref="TransportReceiver"/>
 /// </summary>
 /// <param name="transactionSettings">The transaction settings to use for this <see cref="TransportReceiver"/>.</param>
 /// <param name="maximumConcurrencyLevel">The maximum number of messages to process in parallel.</param>
 /// <param name="maximumThroughput">The maximum throughput per second, 0 means unlimited.</param>
 /// <param name="receiver">The <see cref="IDequeueMessages"/> instance to use.</param>
 /// <param name="manageMessageFailures">The <see cref="IManageMessageFailures"/> instance to use.</param>
 /// <param name="settings">The current settings</param>
 /// <param name="config">Configure instance</param>
 public TransportReceiver(TransactionSettings transactionSettings, int maximumConcurrencyLevel, int maximumThroughput, IDequeueMessages receiver, IManageMessageFailures manageMessageFailures, ReadOnlySettings settings, Configure config)
 {
     this.settings                     = settings;
     this.config                       = config;
     TransactionSettings               = transactionSettings;
     MaximumConcurrencyLevel           = maximumConcurrencyLevel;
     MaximumMessageThroughputPerSecond = maximumThroughput;
     FailureManager                    = manageMessageFailures;
     Receiver = receiver;
 }
 public AmbientTransactionReceiveStrategy(string connectionString, TableBasedQueue errorQueue, Func<TransportMessage, bool> tryProcessMessageCallback, PipelineExecutor pipelineExecutor, TransactionSettings transactionSettings)
 {
     this.pipelineExecutor = pipelineExecutor;
     this.tryProcessMessageCallback = tryProcessMessageCallback;
     this.errorQueue = errorQueue;
     this.connectionString = connectionString;
     transactionOptions = new TransactionOptions
     {
         IsolationLevel = transactionSettings.IsolationLevel,
         Timeout = transactionSettings.TransactionTimeout
     };
 }
Esempio n. 10
0
        /// <summary>
        ///     Initializes the <see cref="IDequeueMessages" />.
        /// </summary>
        /// <param name="address">The address to listen on.</param>
        /// <param name="settings">The <see cref="TransactionSettings" /> to be used by <see cref="IDequeueMessages" />.</param>
        /// <param name="tryProcessMessage">Called when a message has been dequeued and is ready for processing.</param>
        /// <param name="endProcessMessage">
        ///     Needs to be called by <see cref="IDequeueMessages" /> after the message has been
        ///     processed regardless if the outcome was successful or not.
        /// </param>
        public void Init(Address address, TransactionSettings settings, Func<TransportMessage, bool> tryProcessMessage,
            Action<TransportMessage, Exception> endProcessMessage)
        {
            this.tryProcessMessage = tryProcessMessage;
            this.endProcessMessage = endProcessMessage;
            transactionSettings = settings;

            if (address == null)
            {
                throw new ArgumentException("Input queue must be specified");
            }

            if (!address.Machine.Equals(RuntimeEnvironment.MachineName, StringComparison.OrdinalIgnoreCase))
            {
                throw new InvalidOperationException(
                    string.Format("Input queue [{0}] must be on the same machine as this process [{1}].",
                        address, RuntimeEnvironment.MachineName));
            }

            transactionOptions = new TransactionOptions
            {
                IsolationLevel = transactionSettings.IsolationLevel,
                Timeout = transactionSettings.TransactionTimeout
            };

            queue = new MessageQueue(NServiceBus.MsmqUtilities.GetFullPath(address), false, true, QueueAccessMode.Receive);

            if (transactionSettings.IsTransactional && !QueueIsTransactional())
            {
                throw new ArgumentException(
                    "Queue must be transactional if you configure your endpoint to be transactional (" + address + ").");
            }

            var messageReadPropertyFilter = new MessagePropertyFilter
            {
                Body = true,
                TimeToBeReceived = true,
                Recoverable = true,
                Id = true,
                ResponseQueue = true,
                CorrelationId = true,
                Extension = true,
                AppSpecific = true
            };

            queue.MessageReadPropertyFilter = messageReadPropertyFilter;

            if (configure.PurgeOnStartup())
            {
                queue.Purge();
            }
        }
 public IReceiveStrategy Create(TransactionSettings settings, Func<TransportMessage, bool> tryProcessMessageCallback)
 {
     var errorQueue = new TableBasedQueue(errorQueueAddress, localConnectionParams.Schema);
     if (settings.IsTransactional)
     {
         if (settings.SuppressDistributedTransactions)
         {
             return new NativeTransactionReceiveStrategy(localConnectionParams.ConnectionString, errorQueue, tryProcessMessageCallback, pipelineExecutor, settings);
         }
         return new AmbientTransactionReceiveStrategy(localConnectionParams.ConnectionString, errorQueue, tryProcessMessageCallback, pipelineExecutor, settings);
     }
     return new NoTransactionReceiveStrategy(localConnectionParams.ConnectionString, errorQueue, tryProcessMessageCallback);
 }
        public ITransactionScope CreateNewTransactionScope(TransactionSettings transactionSettings, ISession session)
        {
            if (!transactionSettings.IsTransactional)
            {
                return new NoTransactionScope();
            }

            if (transactionSettings.DontUseDistributedTransactions)
            {
                return new ActiveMqTransaction(this.sessionFactory, session);
            }

            return new DTCTransactionScope(session, new TransactionOptions { IsolationLevel = transactionSettings.IsolationLevel, Timeout = transactionSettings.TransactionTimeout }, this.sessionFactory);
        }
        public TransactionScope CreateTransactionScopeForAsyncMessage(TransactionSettings transactionSettings)
        {
            if (!transactionSettings.IsTransactional)
            {
                return null;
            }

            if (transactionSettings.DontUseDistributedTransactions)
            {
                return null;
            }

            return new TransactionScope(TransactionScopeOption.RequiresNew,
                new TransactionOptions { IsolationLevel = transactionSettings.IsolationLevel, Timeout = transactionSettings.TransactionTimeout });
        }
 public void Init(Address address, TransactionSettings transactionSettings, Func<TransportMessage, bool> tryProcessMessage, Action<TransportMessage, Exception> endProcessMessage)
 {
     _realDequeuer.Init(address, transactionSettings, tryProcessMessage, endProcessMessage);
 }
		public void Init(Address address, TransactionSettings transactionSettings, Func<TransportMessage, bool> tryProcessMessage, Action<string, Exception> endProcessMessage)
		{
			
		}