Beispiel #1
0
        private async Task VisitIntermediateCatchTimerEvent(
            TIntermediateCatchEvent intermediateCatchEvent,
            TTimerEventDefinition timerEventDefinition)
        {
            if (timerEventDefinition.TimeDate != null)
            {
                var fireAt = XmlConvert.ToDateTime(timerEventDefinition.TimeDate.Text.First(), XmlDateTimeSerializationMode.Local);
                _logger.LogWarning("Waiting for timer {fireAt}", fireAt);
                await Context.CreateTimer(fireAt, CancellationToken.None);

                _logger.LogWarning("Received timer {fireAt}", fireAt);

                await VisitFlowNodes(GetParallelOutgoingNodes(intermediateCatchEvent));
            }
            else if (timerEventDefinition.TimeDuration != null)
            {
                var duration = XmlConvert.ToTimeSpan(timerEventDefinition.TimeDuration.Text.First());
                var fireAt   = Context.CurrentUtcDateTime.Add(duration);
                _logger.LogWarning("Waiting for timer {fireAt}", fireAt);
                await Context.CreateTimer(fireAt, CancellationToken.None);

                _logger.LogWarning("Received timer {fireAt}", fireAt);

                await VisitFlowNodes(GetParallelOutgoingNodes(intermediateCatchEvent));
            }
            else
            {
                _logger.LogWarning("Not supported timerEventDefinition");
            }
        }
Beispiel #2
0
        private async Task VisitIntermediateCatchMessageEvent(
            TIntermediateCatchEvent intermediateCatchEvent,
            TMessageEventDefinition messageEventDefinition)
        {
            var messageRef = messageEventDefinition.MessageRef.ToString();

            _logger.LogWarning("Waiting for message {message}", messageRef);

            var result = await EventReceiver.WaitForEventAsync <JObject>(messageRef, _terminateCancellationTokenSource.Token);

            _logger.LogWarning("Received message {message}", messageRef);

            await VisitFlowNodes(GetParallelOutgoingNodes(intermediateCatchEvent));
        }
Beispiel #3
0
        private async Task VisitIntermediateCatchEvent(TIntermediateCatchEvent intermediateCatchEvent)
        {
            foreach (var eventDefinition in intermediateCatchEvent.EventDefinition)
            {
                switch (eventDefinition)
                {
                case TMessageEventDefinition messageEventDefinition:
                    await VisitIntermediateCatchMessageEvent(intermediateCatchEvent, messageEventDefinition);

                    break;

                case TTimerEventDefinition timerEventDefinition:
                    await VisitIntermediateCatchTimerEvent(intermediateCatchEvent, timerEventDefinition);

                    break;
                }
            }
        }