コード例 #1
0
        public async Task Handle(TelnyxWebhookReceived notification, CancellationToken cancellationToken)
        {
            var webhook      = notification.Webhook;
            var eventType    = webhook.Data.EventType;
            var payload      = webhook.Data.Payload;
            var activityType = _webhookFilterService.GetActivityTypeName(payload);

            if (activityType == null)
            {
                _logger.LogWarning("The received event '{EventType}' is an unsupported event", webhook.Data.EventType);
                return;
            }

            var correlationId = payload.GetCorrelationId();
            var bookmark      = new NotificationBookmark(eventType);
            var context       = new WorkflowsQuery(activityType, bookmark, correlationId);
            await _workflowLaunchpad.CollectAndDispatchWorkflowsAsync(context, new WorkflowInput(webhook), cancellationToken).ToList();
        }
コード例 #2
0
ファイル: TriggerWorkflows.cs プロジェクト: tle5/elsa-core
        public async Task Handle(TelnyxWebhookReceived message)
        {
            var webhook      = message.Webhook;
            var eventType    = webhook.Data.EventType;
            var payload      = message.Webhook.Data.Payload;
            var activityType = _webhookFilterService.GetActivityTypeName(payload);

            if (activityType == null)
            {
                _logger.LogWarning("The received event '{EventType}' is an unsupported event", webhook.Data.EventType);
                return;
            }

            var correlationId = GetCorrelationId(payload);

            var bookmark = new NotificationBookmark(eventType, correlationId);
            var trigger  = new NotificationBookmark(eventType);

            await _workflowDispatcher.DispatchAsync(new TriggerWorkflowsRequest(activityType, bookmark, trigger, webhook, correlationId, TenantId : TenantId));
        }