Пример #1
0
        public async Task PublishEvent(string eventName, string eventKey, object eventData)
        {
            if (_shutdown)
            {
                throw new Exception("Host is not running");
            }

            _logger.LogDebug("Publishing event {0} {1}", eventName, eventKey);
            var subs = await _persistenceStore.GetSubcriptions(eventName, eventKey);

            foreach (var sub in subs.ToList())
            {
                EventPublication pub = new EventPublication();
                pub.Id         = Guid.NewGuid();
                pub.EventData  = eventData;
                pub.EventKey   = eventKey;
                pub.EventName  = eventName;
                pub.StepId     = sub.StepId;
                pub.WorkflowId = sub.WorkflowId;
                await _queueProvider.QueueForPublishing(pub);

                await _persistenceStore.TerminateSubscription(sub.Id);
            }
        }