Beispiel #1
0
        public override void SendEvent(OrchestrationInstance orchestrationInstance, string eventName, object eventData)
        {
            if (string.IsNullOrWhiteSpace(orchestrationInstance?.InstanceId))
            {
                throw new ArgumentException(nameof(orchestrationInstance));
            }

            int    id = this.idCounter++;
            string serializedEventData = this.dataConverter.Serialize(eventData);

            var action = new SendEventOrchestratorAction
            {
                Id        = id,
                Instance  = orchestrationInstance,
                EventName = eventName,
                EventData = serializedEventData,
            };

            this.orchestratorActionsMap.Add(id, action);
        }
Beispiel #2
0
        static TaskMessage ProcessSendEventDecision(
            SendEventOrchestratorAction sendEventAction,
            OrchestrationRuntimeState runtimeState)
        {
            var historyEvent = new EventSentEvent(sendEventAction.Id)
            {
                InstanceId = sendEventAction.Instance.InstanceId,
                Name       = sendEventAction.EventName,
                Input      = sendEventAction.EventData
            };

            runtimeState.AddEvent(historyEvent);

            return(new TaskMessage
            {
                OrchestrationInstance = sendEventAction.Instance,
                Event = new EventRaisedEvent(-1, sendEventAction.EventData)
                {
                    Name = sendEventAction.EventName
                }
            });
        }