Пример #1
0
 public MessageContext(KafkaMessage kafkaMessage, int partition, long offset)
 {
     KafkaMessage            = kafkaMessage;
     Offset                  = offset;
     Partition               = partition;
     ToBeSentMessageContexts = new List <IMessageContext>();
 }
Пример #2
0
 public MessageContext(object message, string id = null)
 {
     KafkaMessage = new KafkaMessage();
     SentTime     = DateTime.Now;
     Message      = message;
     if (!string.IsNullOrEmpty(id))
     {
         MessageID = id;
     }
     else if (message is IMessage)
     {
         MessageID = (message as IMessage).ID;
     }
     else
     {
         MessageID = ObjectId.GenerateNewId().ToString();
     }
     ToBeSentMessageContexts = new List <IMessageContext>();
     if (message != null && message is IMessage)
     {
         Topic = (message as IMessage).GetTopic();
     }
 }