Ejemplo n.º 1
0
        /// <summary>生产消息</summary>
        /// <param name="job">作业</param>
        /// <param name="topic">主题</param>
        /// <param name="messages">消息集合</param>
        /// <param name="option">消息选项</param>
        /// <returns></returns>
        public override Int32 Produce(String job, String topic, String[] messages, MessageOption option = null)
        {
            if (topic.IsNullOrEmpty() || messages == null || messages.Length < 1)
            {
                return(0);
            }

            return(Ant.Produce(job, topic, messages, option));
        }
Ejemplo n.º 2
0
        /// <summary>生产消息</summary>
        /// <param name="job">作业</param>
        /// <param name="topic">主题</param>
        /// <param name="messages">消息集合</param>
        /// <param name="option">消息选项</param>
        /// <returns></returns>
        public Int32 Produce(String job, String topic, String[] messages, MessageOption option = null)
        {
            var dic = new { job, topic, messages }.ToDictionary();

            if (option != null)
            {
                dic = dic.Merge(option);
            }

            return(Invoke <Int32>(nameof(Produce), dic));
        }
Ejemplo n.º 3
0
        /// <summary>生产消息</summary>
        /// <param name="job">作业</param>
        /// <param name="topic">主题</param>
        /// <param name="messages">消息集合</param>
        /// <param name="option">消息选项</param>
        /// <returns></returns>
        public override Int32 Produce(String job, String topic, String[] messages, MessageOption option = null)
        {
            if (topic.IsNullOrEmpty() || messages == null || messages.Length < 1)
            {
                return(0);
            }

            var model = new ProduceModel
            {
                Job      = job,
                Topic    = topic,
                Messages = messages,
            };

            if (option != null)
            {
                model.DelayTime = option.DelayTime;
                model.Unique    = option.Unique;
            }

            return(Ant.Produce(model));
        }
Ejemplo n.º 4
0
 /// <summary>生产消息</summary>
 /// <param name="job">作业</param>
 /// <param name="topic">主题</param>
 /// <param name="messages">消息集合</param>
 /// <param name="option">消息选项</param>
 /// <returns></returns>
 public virtual Int32 Produce(String job, String topic, String[] messages, MessageOption option = null) => 0;