Esempio n. 1
0
        public override void Emit(string streamId, List <StormTuple> anchors, List <object> values, string taskId = null)
        {
            List <string> tupleIds = new List <string>();

            if (anchors != null && anchors.Count > 0)
            {
                foreach (var anchor in anchors)
                {
                    tupleIds.Add(anchor.GetTupleId());
                }
            }

            base.CheckOutputSchema(streamId, values == null ? 0 : values.Count);

            if (string.IsNullOrEmpty(taskId))
            {
                string msg = @"""command"": ""emit"", ""anchors"": {0}, ""stream"": ""{1}"", ""tuple"": {2}";
                ApacheStorm.SendMsgToParent("{" + string.Format(msg, JsonConvert.SerializeObject(tupleIds), streamId, JsonConvert.SerializeObject(values)) + "}");
                ApacheStorm.ReadTaskId();
            }
            else
            {
                string msg = @"""command"": ""emit"", ""anchors"": {0}, ""stream"": ""{1}"", ""task"": {2}, ""tuple"": {3}";
                ApacheStorm.SendMsgToParent("{" + string.Format(msg, JsonConvert.SerializeObject(tupleIds), streamId, taskId, JsonConvert.SerializeObject(values)) + "}");
            }
        }
Esempio n. 2
0
        private void SendLog(string Message, int level = 2)
        {
            LoggerMsg message = new LoggerMsg();

            message.command = "log";
            message.msg     = classMsg + Message;
            message.level   = level;

            ApacheStorm.SendMsgToParent(JsonConvert.SerializeObject(message));
        }
Esempio n. 3
0
        public override void Emit(string streamId, List <object> values, long seqId, string taskId = null)
        {
            base.CheckOutputSchema(streamId, values == null ? 0 : values.Count);

            if (string.IsNullOrEmpty(taskId))
            {
                string msg = @"""command"": ""emit"", ""id"": ""{0}"", ""stream"": ""{1}"", ""tuple"": {2}";
                ApacheStorm.SendMsgToParent("{" + string.Format(msg, seqId.ToString(), streamId, JsonConvert.SerializeObject(values)) + "}");
                ApacheStorm.ReadTaskId();
            }
            else
            {
                string msg = @"""command"": ""emit"", ""id"": ""{0}"", ""stream"": ""{1}"", ""task"": {2}, ""tuple"": {3}";
                ApacheStorm.SendMsgToParent("{" + string.Format(msg, seqId.ToString(), streamId, taskId, JsonConvert.SerializeObject(values)) + "}");
            }
        }