public MessageContext(object message, string id = null) { EqueueMessage = new EQueueMessage(); 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(); } ToBeSentMessageContexts = new List <IMessageContext>(); if (message is IMessage iMessage) { Topic = iMessage.GetTopic(); Tags = iMessage.Tags; } MessageOffset = new MessageOffset(); }
public HandledEvent(string id, string subscriptionName, MessageOffset messageOffset, DateTime handledTime) { Id = id; SubscriptionName = subscriptionName; MessageOffset = messageOffset; HandledTime = handledTime; }
public EmptyMessageContext(IMessage message) { SentTime = DateTime.Now; Message = message; MessageId = message.Id; MessageOffset = new MessageOffset(); }
/// <summary> /// </summary> /// <param name="messageOffset"></param> protected virtual void FinishConsumingMessage(MessageOffset messageOffset) { var slidingDoor = SlidingDoors.TryGetValue(messageOffset.SlidingDoorKey); if (slidingDoor == null) { throw new Exception("partition slidingDoor not exists"); } slidingDoor.RemoveOffset(messageOffset); }
private void CommitOffset(MessageOffset messageOffset) { try { CommitOffsetAsync(messageOffset.Broker, messageOffset.Topic, messageOffset.Partition, messageOffset.Offset) .ContinueWith(t => { if (t.IsFaulted) { Logger.LogError(t.Exception, $"CommitOFfsetAsync failed"); } }); } catch (Exception e) { Logger.LogError(e, $"CommitOffset failed {messageOffset.ToJson()}"); } }
public MessageContext(EQueueMessage equeueMessage, MessageOffset messageOffset) { EqueueMessage = equeueMessage; ToBeSentMessageContexts = new List <IMessageContext>(); MessageOffset = messageOffset; }
public MessageContext(RabbitMQMessage rabbitMQMessage, MessageOffset deliveryTag) { RabbitMQMessage = rabbitMQMessage; ToBeSentMessageContexts = new List <IMessageContext>(); MessageOffset = deliveryTag; }
public FailHandledEvent(string id, string subscriptionName, MessageOffset messageOffset, DateTime handledTime, Exception e) : base(id, subscriptionName, messageOffset, handledTime) { Error = e.GetBaseException().Message; StackTrace = e.StackTrace; }
public MessageContext(KafkaMessage kafkaMessage, string topic, int partition, long offset) { KafkaMessage = kafkaMessage; MessageOffset = new MessageOffset(null, topic, partition, offset); }
public EmptyMessageContext() { MessageOffset = new MessageOffset(); }
public HandledEvent(string id, string subscriptionName, MessageOffset messageOffset, DateTime handledTime) : base(id, subscriptionName, messageOffset, handledTime) { }
public HandledEventBase(string id, string subscriptionName, MessageOffset messageOffset, DateTime handledTime) : base(id, subscriptionName, messageOffset, handledTime) { EventId = id; Id = $"{EventId}_{subscriptionName}"; }