예제 #1
0
        private void ReceiveMessage(OpenedQueue queue, string messageId, Func <CurrentMessageInformation, bool> messageArrived, Action <CurrentMessageInformation, Exception> messageProcessingCompleted)
        {
            var message = queue.TryGetMessageFromQueue(messageId);

            if (message == null)
            {
                return;
            }
            ProcessMessage(message, queue, null, messageArrived, null, null, messageProcessingCompleted);
        }
예제 #2
0
        public void ReceiveMessageInTransaction(OpenedQueue queue, string messageId, Func <CurrentMessageInformation, bool> messageArrived, Action <CurrentMessageInformation, Exception> messageProcessingCompleted, Action <CurrentMessageInformation> beforeMessageTransactionCommit, Action <CurrentMessageInformation> beforeMessageTransactionRollback)
        {
            var transactionOptions = new TransactionOptions
            {
                IsolationLevel = queueIsolationLevel,
                Timeout        = TransportUtil.GetTransactionTimeout(),
            };

            using (var tx = new TransactionScope(TransactionScopeOption.Required, transactionOptions))
            {
                var message = queue.TryGetMessageFromQueue(messageId);
                if (message == null)
                {
                    return; // someone else got our message, better luck next time
                }
                ProcessMessage(message, queue, tx, messageArrived, beforeMessageTransactionCommit, beforeMessageTransactionRollback, messageProcessingCompleted);
            }
        }