Beispiel #1
0
        /// <summary>
        /// Called each time a message arrives for this consumer.
        /// </summary>
        /// <param name="consumerTag"></param>
        /// <param name="deliveryTag"></param>
        /// <param name="redelivered"></param>
        /// <param name="exchange"></param>
        /// <param name="routingKey"></param>
        /// <param name="properties"></param>
        /// <param name="body"></param>
        public override void HandleBasicDeliver(string consumerTag,
                                                ulong deliveryTag,
                                                bool redelivered,
                                                string exchange,
                                                string routingKey,
                                                IBasicProperties properties,
                                                byte[] body)
        {
            Messaging.Message message = null;
            try { message = ThriftMarshaller.Deserialize <Messaging.Message>(body); }
            catch (Exception ex) { Trace.TraceError(ex.ToString()); return; }

            message.CreatedTick = DateTimeSlim.UtcNow.Ticks;
            this._callback(message);
        }
Beispiel #2
0
 void LoadFromFile()
 {
     if (!File.Exists(PersistPath))
     {
         Data = new List <ThriftMention>();
     }
     else
     {
         try
         {
             var binary = File.ReadAllBytes(PersistPath);
             var set    = ThriftMarshaller.Deserialize <ThriftMentionChunk>(binary);
             Data = set.Mentions ?? new List <ThriftMention>();
         }
         catch
         {
             Trace.WriteLine("FAILED TO LOAD FILE:" + PersistPath);
         }
     }
 }
 List <ThriftMention> DeserializeMentions(byte[] data)
 {
     return(ThriftMarshaller.Deserialize <ThriftMentionChunk>(data).Mentions);
 }
        //#####################################################

        List <ThriftDatapoint> DeserializeDatapoints(byte[] data)
        {
            return(ThriftMarshaller.Deserialize <ThriftDatapointChunk>(data).Datapoints);
        }