Пример #1
0
        public override void Call(IProcessor processor, dynamic data)
        {
            string setting = ConfigurationManager.AppSettings.Get(data.AppSetting);
            var    resp    = AgentType.New().KeyValue("Value", setting).Get();

            SetContextAndType(data, resp);
            processor.QueueData(resp);
        }
Пример #2
0
        static void SayHello(Processor processor)
        {
            var hello  = AgentType.New("App", "LogMessage").KeyValue("Message", "Agent System Running").Get();
            var dbName = AgentType.New("AppSetting", "Key").KeyValue("AppSetting", "dbName").KeyValue("ResponseContext", "dbName").Get();

            processor.QueueData(hello);
            processor.QueueData(dbName);
        }
Пример #3
0
        public async override void Call(IProcessor processor, dynamic data)
        {
            HttpClient client = new HttpClient();

            using (var response = await client.GetAsync(data.url, HttpCompletionOption.ResponseHeadersRead))
            {
                if (response.IsSuccessStatusCode)
                {
                    using (var stream = await response.Content.ReadAsStreamAsync())
                    {
                        var image = Image.FromStream(stream);
                        var resp  = AgentType.New().KeyValue("Image", image).Get();
                        SetContextAndType(data, resp);
                        processor.QueueData(resp);
                    }
                }
            }
        }