示例#1
0
文件: Consumer.cs 项目: rokeller/aqua
        /// <summary>
        /// Initializes a new instance of Consumer using the given connectionSettings to connect to the Queue.
        /// </summary>
        /// <param name="connectionSettings">
        /// The ConnectionSettings which define the Storage Account and Queue to use.
        /// </param>
        /// <param name="factory">
        /// The JobFactory to use to create instances of IJob.
        /// </param>
        /// <param name="settings">
        /// The ConsumerSettings to use. If null, the default ConsumerSettings will be used.
        /// </param>
        public Consumer(ConnectionSettings connectionSettings, JobFactory factory, ConsumerSettings settings)
        {
            if (null == connectionSettings)
            {
                throw new ArgumentNullException("connectionSettings");
            }
            else if (null == factory)
            {
                throw new ArgumentNullException("factory");
            }

            queue = connectionSettings.GetQueue();
            queue.CreateIfNotExistsAsync().GetAwaiter().GetResult();

            this.connectionSettings = connectionSettings;
            this.factory            = factory;
            this.consumerSettings   = settings ?? ConsumerSettings.CreateDefault();
        }
示例#2
0
文件: Consumer.cs 项目: rokeller/aqua
 /// <summary>
 /// Initializes a new instance of Consumer using the given connectionSettings to connect to the Queue, and
 /// using the default ConsumerSettings.
 /// </summary>
 /// <param name="connectionSettings">
 /// The ConnectionSettings which define the Azure Storage Account and Queue to use.
 /// </param>
 /// <param name="factory">
 /// The JobFactory to use to create instances of IJob.
 /// </param>
 public Consumer(ConnectionSettings connectionSettings, JobFactory factory)
     : this(connectionSettings, factory, ConsumerSettings.CreateDefault())
 {
 }