Ejemplo n.º 1
0
 /// <summary>
 /// Writes request and response raw data into Redis
 /// </summary>
 /// <param name="data">Request and response metrics in raw form</param>
 /// <returns>A completed task</returns>
 public override async Task Write(RequestResponseData data)
 {
     try
     {
         ServiceStack.Redis.RedisClient client = new ServiceStack.Redis.RedisClient();
         client.Add<RequestResponseData>(data.ID.ToString(), data, TimeSpan.FromMinutes(15));
     }
     catch (Exception ex)
     {
         // We need to handle these exceptions
     }
 }
 /// <summary>
 /// Writes request and response raw data into Redis
 /// </summary>
 /// <param name="data">Request and response metrics in raw form</param>
 /// <returns>A completed task</returns>
 public override async Task Write(RequestResponseData data)
 {
     try
     {
         ServiceStack.Redis.RedisClient client = new ServiceStack.Redis.RedisClient();
         client.ConnectTimeout = 3;
         client.SendTimeout = 3;
         client.Add<RequestResponseData>(data.ID.ToString(), data, TimeSpan.FromMinutes(30));
     }
     catch (Exception ex)
     {
         Trace.Write(ex.Message);
     }
 }
        /// <summary>
        /// Sends request and response raw data to Kafka
        /// </summary>
        /// <param name="data">Request and response metrics in raw form</param>
        /// <returns>A completed task</returns>
        public override async Task Write(RequestResponseData data)
        {
            try
            {
                KafkaOptions options = new KafkaOptions(new Uri("http://SERVER1:9092"), new Uri("http://SERVER2:9092"));
                BrokerRouter router = new BrokerRouter(options);
                Producer client = new Producer(router);

                client.SendMessageAsync("API-Meter Data", new[] { new Message { Value = "NULL for now" } }).Wait();
            }
            catch (Exception ex)
            {
                Trace.Write(ex.Message);
            }
        }
Ejemplo n.º 4
0
 public void WriteRequestResponse(RequestResponseData data)
 {
     RedisBufferDataProvider dataProvider = new RedisBufferDataProvider();
     dataProvider.Write(data);
 }
Ejemplo n.º 5
0
 public abstract Task Write(RequestResponseData data);
Ejemplo n.º 6
0
 public void Dispose()
 {
     this._timer = null;
     this._data = null;
 }