/// <summary> /// Execute before flow process /// </summary> /// <param name="state"></param> /// <param name="message"></param> /// <param name="from"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task OnFlowPreProcessingAsync(State state, Message message, Node from, CancellationToken cancellationToken) { // Cancel Schedule expiration time if input is configured if (state.HasInputExpiration() && !IsMessageFromExpiration(message)) { var messageId = GetInputExirationIdMessage(message); await _schedulerExtension.CancelScheduledMessageAsync(messageId, from, cancellationToken); } }
/// <summary> /// Execute before flow process /// </summary> /// <param name="state"></param> /// <param name="message"></param> /// <param name="from"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task OnFlowPreProcessingAsync(State state, Message message, Node from, CancellationToken cancellationToken) { // Cancel Schedule expiration time if input is configured if (state.HasInputExpiration() && !IsMessageFromExpiration(message)) { var messageId = GetInputExirationIdMessage(message); Schedule scheduledMessage = null; try { scheduledMessage = await _schedulerExtension.GetScheduledMessageAsync(messageId, from, cancellationToken); } catch (Exception ex) { _logger.Warning(ex, "Scheduled message with id '{MessageId}' not scheduled", messageId); } if (scheduledMessage != null) { await _schedulerExtension.CancelScheduledMessageAsync(messageId, from, cancellationToken); } } }