Ejemplo n.º 1
0
		/// <summary>
		/// Gets a value indicating whether a queue with the specified name exists.
		/// </summary>
		/// <param name="queueName"></param>
		/// <returns></returns>
		public bool QueueExists(MsmqName queueName)
		{
			if (queueName.IsSubQueue)
				throw new InvalidOperationException("A subqueue cannot be checked for existence.");

			return MessageQueue.Exists(queueName.Path);
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Creates a queue with the specified name, and returns a <see cref="MessageQueue"/> instance for it.
		/// </summary>
		/// <param name="queueName"></param>
		/// <returns></returns>
		/// <remarks>
		/// The specified queue must not already exist. Also, the supplied <see cref="MsmqName"/> must not refer to
		/// a subqueue, because subqueues cannot be explicitly created.
		/// </remarks>
		public MessageQueue CreateQueue(MsmqName queueName)
		{
			if (queueName.IsSubQueue)
				throw new InvalidOperationException("A subqueue cannot be explicitly created.");

			MessageQueue.Create(queueName.Path);
			return GetQueue(queueName);
		}
Ejemplo n.º 3
0
        /// <summary>
        /// Gets a value indicating whether a queue with the specified name exists.
        /// </summary>
        /// <param name="queueName"></param>
        /// <returns></returns>
        public bool QueueExists(MsmqName queueName)
        {
            if (queueName.IsSubQueue)
            {
                throw new InvalidOperationException("A subqueue cannot be checked for existence.");
            }

            return(MessageQueue.Exists(queueName.Path));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a queue with the specified name, and returns a <see cref="MessageQueue"/> instance for it.
        /// </summary>
        /// <param name="queueName"></param>
        /// <returns></returns>
        /// <remarks>
        /// The specified queue must not already exist. Also, the supplied <see cref="MsmqName"/> must not refer to
        /// a subqueue, because subqueues cannot be explicitly created.
        /// </remarks>
        public MessageQueue CreateQueue(MsmqName queueName)
        {
            if (queueName.IsSubQueue)
            {
                throw new InvalidOperationException("A subqueue cannot be explicitly created.");
            }

            MessageQueue.Create(queueName.Path);
            return(GetQueue(queueName));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Returns a new <see cref="MessageQueue"/> instance for the queue with the specified name.
        /// </summary>
        /// <param name="queueName"></param>
        /// <returns></returns>
        /// <remarks>
        /// The specified queue must already exist.
        /// </remarks>
        public MessageQueue GetQueue(MsmqName queueName)
        {
            var path = string.Format("FormatName:{0}", queueName.FormatName);

            return(new MoveTargetableMessageQueue(path, false, true));
        }
Ejemplo n.º 6
0
		/// <summary>
		/// Returns a new <see cref="MessageQueue"/> instance for the queue with the specified name.
		/// </summary>
		/// <param name="queueName"></param>
		/// <returns></returns>
		/// <remarks>
		/// The specified queue must already exist.
		/// </remarks>
		public MessageQueue GetQueue(MsmqName queueName)
		{
			var path = string.Format("FormatName:{0}", queueName.FormatName);
			return new MoveTargetableMessageQueue(path, false, true);
		}