Exemple #1
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 = ((IMessage)message).ID;
     }
     else
     {
         MessageID = ObjectId.GenerateNewId().ToString();
     }
     if (message != null && message is IMessage)
     {
         Topic = (message as IMessage).GetTopic();
     }
 }
Exemple #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 = ((IMessage)message).Id;
     }
     else
     {
         MessageId = ObjectId.GenerateNewId().ToString();
     }
     if (message is IMessage iMessage)
     {
         Topic = iMessage.GetTopic();
         Tags  = iMessage.Tags;
     }
     MessageOffset = new MessageOffset();
 }
Exemple #3
0
 public MessageContext(KafkaMessage kafkaMessage, int partition, long offset)
 {
     KafkaMessage = kafkaMessage;
     Offset       = offset;
     Partition    = partition;
 }
Exemple #4
0
 public MessageContext(KafkaMessage kafkaMessage, string topic, int partition, long offset)
 {
     KafkaMessage  = kafkaMessage;
     MessageOffset = new MessageOffset(null, topic, partition, offset);
 }