/// <summary>
        /// 添加本地消息队列中心配置
        /// </summary>
        /// <param name="config">本地消息队列中心配置</param>
        public static void AddLMQConfig(LMQConfig config)
        {
            if (config == null)
            {
                return;
            }

            _lmqConfigDic.AddOrUpdate(config.Topic, config, (t, c) => { return(config); });
        }
示例#2
0
        /// <summary>
        /// 发布消息
        /// </summary>
        /// <param name="message">消息</param>
        public void Publish(object message)
        {
            LMQConfig config      = LMQConfigManager.GetLMQConfig(this.Topic);
            var       publishItem = new PublishItem(config, message);

            if (config != null && config.SyncPublish)
            {
                this.PublishThreadMethod(publishItem);
            }
            else
            {
                if (this._asynPublishParaQueueThread == null)
                {
                    string name = string.Format("本地消息队列主题{0}数据消息发布线程", this.Topic);
                    this._asynPublishParaQueueThread = new AsynQueue <PublishItem>(this.PublishThreadMethod, name, true, true);
                }

                this._asynPublishParaQueueThread.Enqueue(publishItem);
            }
        }
示例#3
0
 public PublishItem(LMQConfig config, object message)
 {
     this.Config  = config;
     this.Message = message;
 }