Esempio n. 1
0
 public void Execute(StormTuple tuple)
 {
     Context.Logger.Info("SimpleDRPC Execute enter");
     
     string sentence = tuple.GetString(0) + "!";
     this.ctx.Emit("default", new List<StormTuple> { tuple }, new List<object> { sentence, tuple.GetValue(1) });
     Context.Logger.Info("SimpleDRPC Execute exit");
     ApacheStorm.Ack(tuple);
 }
Esempio n. 2
0
        /// <summary>
        /// The Execute() function will be called, when a new tuple is available.
        /// </summary>
        /// <param name="tuple"></param>
        public void Execute(StormTuple tuple)
        {
            Context.Logger.Info("Execute enter");

            string sentence = tuple.GetString(0);

            foreach (string word in sentence.Split(' '))
            {
                Context.Logger.Info("Splitter Emit: {0}", word);
                this.ctx.Emit("default", new List<StormTuple> { tuple }, new List<object> { word, word[0] });
            }

            Context.Logger.Info("Splitter Execute exit");
        }
Esempio n. 3
0
        /// <summary>
        /// The Execute() function will be called, when a new tuple is available.
        /// </summary>
        /// <param name="tuple"></param>
        public void Execute(StormTuple tuple)
        {
            Context.Logger.Info("Execute enter");

            string word = tuple.GetString(0);
            int count = counts.ContainsKey(word) ? counts[word] : 0;
            count++;
            counts[word] = count;

            Context.Logger.Info("Counter Emit: {0}, count: {1}", word, count);
            this.ctx.Emit("default", new List<StormTuple> { tuple }, new List<object> { word, count });

            Context.Logger.Info("Counter Execute exit");
        }