public WorkflowBusSubscriber(string correlationId) { Messages = new InMemoryMessageQueueRepository <WorflowFeedMessage>(); CorrelationId = correlationId; //InstanceDone will clear hub subscriber and remove itself from the static list of subscribers //if the answer is never done, we should clear this System.Timers.Timer timer = new System.Timers.Timer(TimeSpan.FromMinutes(20).TotalSeconds); timer.Elapsed += (_, __) => { InstanceDone?.Invoke(new WorkflowBusSubscriberDoneArgs(this)); }; }
/// <summary> /// Callback method listening to service bus for event WorkflowStatusError of <see cref="CorrelationId"/> /// </summary> /// <param name="result"></param> public void QueueResponseStatusError(ServiceBusMessage result) { Messages.Enqueue(new WorflowFeedMessage(result, WorkflowFeedMessageType.StatusError)); TrySendMessagesInternal(); InstanceDone?.Invoke(new WorkflowBusSubscriberDoneArgs(this)); }