Exemplo 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);
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            if (args.Count() > 0)
            {
                string compName = args[0];

                try
                {
                    if ("generator".Equals(compName))
                    {
                        ApacheStorm.LaunchPlugin(new newPlugin(Generator.Get));
                    }
                    else if ("splitter".Equals(compName))
                    {
                        ApacheStorm.LaunchPlugin(new newPlugin(Splitter.Get));
                    }
                    else if ("counter".Equals(compName))
                    {
                        ApacheStorm.LaunchPlugin(new newPlugin(Counter.Get));
                    }
                    else if ("SimpleDRPC".Equals(compName))
                    {
                        ApacheStorm.LaunchPlugin(new newPlugin(SimpleDRPC.Get));
                    }
                    else
                    {
                        throw new Exception(string.Format("unexpected compName: {0}", compName));
                    }
                }
                catch (Exception ex)
                {
                    Context.Logger.Error(ex.ToString());
                }
            }
            else
            {
                Context.Logger.Error("Not support local model.");
            }
        }
Exemplo n.º 3
0
 private void SendLog(string Message, int level = 2)
 {
     ApacheStorm.SendMsgToParent("{\"command\": \"log\", \"msg\": \"" + classMsg + Message + "\", \"level\":" + level + "}");
 }