当前位置: 首页>>代码示例>>C#>>正文


C# QueueName.ToString方法代码示例

本文整理汇总了C#中QueueName.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# QueueName.ToString方法的具体用法?C# QueueName.ToString怎么用?C# QueueName.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueueName的用法示例。


在下文中一共展示了QueueName.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Name

 public string Name(QueueName name)
 {
     var val = _ht[name];
     if (val == null)
     {
         val = name.ToString("G");
         _ht[name] = val;
     }
     return val.ToString();
 }
开发者ID:yaozd,项目名称:RabbitMqPerformance,代码行数:10,代码来源:QueueNameHelper.cs

示例2: ToEvent

 public static Event ToEvent(this BrokeredMessage message,
    QueueName queueName)
     {
     return
         new Event()
         {
             Body = message.GetBody<string>(),
             ContentType = message.ContentType,
             EventType = queueName.TopicName,
             QueueName = queueName.ToString(),
             UnderlyingMessage = message
         };
 }
开发者ID:csuffyy,项目名称:BeeHive,代码行数:13,代码来源:BrokeredMessageExtensions.cs

示例3: Prepare

        /// <summary>
        /// Stages indexes. Should run only using one process.
        /// </summary>
        /// <param name="scope"></param>
        /// <param name="documentType"></param>
        /// <param name="rebuild"></param>
        /// <exception cref="System.ArgumentNullException">scope</exception>
        public void Prepare(string scope, string documentType = "", bool rebuild = false)
        {
            if (String.IsNullOrEmpty(scope))
                throw new ArgumentNullException("scope");

            foreach (var builder in _indexBuilders)
            {
                // skip not requested indexers or index using all if index is not specified
                if (!String.IsNullOrEmpty(documentType) && !documentType.Equals(builder.DocumentType))
                    continue;

                // Execute builder, which will create partitions and put them in the queue
                var queueName = new QueueName("index-{0}-{1}-in", scope, builder.DocumentType);

                var config = GetBuildConfig(_repository, queueName.Scope, queueName.DocumentType);

                var lastBuild = DateTime.UtcNow;
                var newBuildDate = lastBuild;
                if (config.Status == BuildStatus.NeverStarted.GetHashCode() || rebuild) // build was never started, so set min date
                {
                    rebuild = true;
                    lastBuild = DateTime.MinValue;
                    config.LastBuildDate = DateTime.UtcNow.AddYears(-30); // have to set the date to something repository won't complain
                }
                else
                {
                    lastBuild = config.LastBuildDate.AddSeconds(-30); // make sure we get all the changes 
                }

                // Delete all the records
                if (rebuild)
                {
                    _searchProvider.RemoveAll(queueName.Scope, queueName.DocumentType);
                }

                var partitions = builder.CreatePartitions(queueName.Scope, lastBuild);

                var newPartitionsExist = false; // tells if there are any partitions that has been processed
                foreach (var partition in partitions)
                {
                    newPartitionsExist = true;
                    //_observer.Notify(new ConsumeBegin(msg, consumer, envelope.QueueName));
                   _messageSender.Send(queueName.ToString(), partition);
                }

                var newBuildStatus = BuildStatus.Started;
                if (newPartitionsExist)
                {
                    _messageSender.Send(queueName.ToString(), new SearchIndexStatusMessage(queueName.Scope, queueName.DocumentType, BuildStatus.Completed));
                }
                else
                {
                    newBuildStatus = BuildStatus.Completed;
                }

                config.LastBuildDate = newBuildDate;
                config.Status = newBuildStatus.GetHashCode();
                _repository.UnitOfWork.Commit();
            }
        }
开发者ID:Wdovin,项目名称:vc-community,代码行数:67,代码来源:SearchIndexController.cs

示例4: GetQueueClient

            public QueueClient GetQueueClient(QueueName queueName)
            {

                Func<object> factory = () =>
                    QueueClient.CreateFromConnectionString(_connectionString,
                        queueName.TopicName);

                if (_cache)
                {

                    var lazy =
                    _cachedClients.GetOrAdd(
                        queueName.ToString(),
                        (name) =>

                            new Lazy<object>(factory));

                    return (QueueClient)lazy.Value;

                }

                return (QueueClient)factory();
            }
开发者ID:FeodorFitsner,项目名称:BeeHive,代码行数:23,代码来源:ServiceBusOperator.cs

示例5: SucceededTasks

		/// <summary>
		/// Returns all succeeded tasks.
		/// </summary>
		/// <param name="queue"></param>
		/// <returns></returns>
		public IList<TaskMessage> SucceededTasks(QueueName queue)
		{
			if (string.IsNullOrEmpty(queue.ToString()))
				throw new NoQueueSpecifiedException(
					"Parameter <queue> is empty or null. Cannot retrieve task for no queue.");

			return TypedClient.Lists[queue.NameWhenSucceeded];
		}
开发者ID:e-travel,项目名称:RedisQueue.Net,代码行数:13,代码来源:QueueClient.cs

示例6: Reserve

		/// <summary>
		/// Obtains the first available task from the specified queue, and changes the client's
		/// state into TaskReserved. In that state, no new tasks can be reserved until the 
		/// task's outcome is evident.
		/// </summary>
		/// <param name="queue"></param>
		/// <returns></returns>
		public TaskMessage Reserve(QueueName queue)
		{
			if (State == RedisQueueState.TaskReserved)
				throw new TaskAlreadyReservedException("Cannot reserve multiple tasks at once.");

			if (string.IsNullOrEmpty(queue.ToString()))
				throw new NoQueueSpecifiedException(
					"Parameter <queue> is empty or null. Cannot retrieve task for no queue.");

			if (TypedClient.Lists[queue.NameWhenPending].Count == 0)
				throw new QueueIsEmptyException("No tasks available in specified queue.");

			CurrentTask = TypedClient.Lists[queue.NameWhenPending].RemoveStart();
			State = RedisQueueState.TaskReserved;

			Log.Info("Reserved task from [" + queue.NameWhenPending + "]");
			Log.DebugFormat("Task Parameters: {0}", CurrentTask.Parameters);

			CacheCurrentTask();

			return CurrentTask;
		}
开发者ID:e-travel,项目名称:RedisQueue.Net,代码行数:29,代码来源:QueueClient.cs


注:本文中的QueueName.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。