Exemplo n.º 1
0
        public void HandleBasicDeliver(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, IBasicProperties properties, byte[] body)
        {
            Debug.WriteLine(String.Format("Recieved: {0}", Encoding.UTF8.GetString(body)));

            RabbitMQ.JSONAgeGender o = JsonConvert.DeserializeObject <RabbitMQ.JSONAgeGender>(Encoding.UTF8.GetString(body));
            o.ReceivedTimeStamp = Environment.TickCount;
            // keep track of this data
            this.AddAgeGender(o);
        }
Exemplo n.º 2
0
 private void AddAgeGender(RabbitMQ.JSONAgeGender ageGender)
 {
     lock (_ageGender)
     {
         _ageGender.Add(ageGender);
         // remove - lean up our collection of Age and gender info
         for (int i = _ageGender.Count - 1; i >= 0; i--)
         {
             if (Environment.TickCount - _ageGender[i].ReceivedTimeStamp > DATA_LIFESPAN_MS)
             {
                 _ageGender.RemoveAt(i);
             }
         }
     }
 }