Esempio n. 1
0
        /// <summary>
        /// See IQueueAdminService.
        /// </summary>
        public void Create(QueueInfo queueInfo)
        {
            try
            {
                this.manager.Create(queueInfo);
            }
            catch (FaultException<QueueErrorInfo>)
            {
                throw;
            }
            catch (Exception ex)
            {
                ErrorLogger.Log(ex);

                var errorInfo = QueueErrorInfo.FromErrorCode(QueueErrorCode.CannotCreateQueue);
                errorInfo.QueueInfo = queueInfo;

                throw new FaultException<QueueErrorInfo>(errorInfo);
            }
        }
Esempio n. 2
0
 public MessageQueue(QueueInfo queueInfo, string persistLocation, string transitLocation)
 {
     this.queueInfo = queueInfo;
     this.persistLocation = persistLocation;
     this.transitLocation = transitLocation;
 }
Esempio n. 3
0
        public void Create(QueueInfo queueInfo)
        {
            if (queueInfo.IsTransactional && !queueInfo.IsPersisted)
            {
                throw new FaultException<QueueErrorInfo>(
                    QueueErrorInfo.FromErrorCode(QueueErrorCode.TransactionalQueueMustBePersisted));
            }

            this.queueMap.ExecuteWithinWriteLock(value =>
            {
                if (value.ContainsKey(queueInfo.Name))
                {
                    var errorInfo = QueueErrorInfo.FromErrorCode(QueueErrorCode.QueueAlreadyExists);
                    errorInfo.QueueInfo = queueInfo;

                    throw new FaultException<QueueErrorInfo>(errorInfo);
                }

                value[queueInfo.Name] = new MessageQueue(queueInfo, this.persistLocation, this.transitLocation);

                this.SaveQueueInfos(value.Values.Select(x => x.QueueInfo).ToArray());
            });
        }