/// <summary>Parameterized constructor. /// </summary> /// <param name="eventHandlerTypeCodeProvider"></param> /// <param name="eventHandlerProvider"></param> /// <param name="eventPublishInfoStore"></param> /// <param name="eventHandleInfoStore"></param> /// <param name="eventHandleInfoCache"></param> /// <param name="actionExecutionService"></param> /// <param name="loggerFactory"></param> public DefaultEventProcessor( IEventHandlerTypeCodeProvider eventHandlerTypeCodeProvider, IEventHandlerProvider eventHandlerProvider, IEventPublishInfoStore eventPublishInfoStore, IEventHandleInfoStore eventHandleInfoStore, IEventHandleInfoCache eventHandleInfoCache, IActionExecutionService actionExecutionService, ILoggerFactory loggerFactory) { _eventHandlerTypeCodeProvider = eventHandlerTypeCodeProvider; _eventHandlerProvider = eventHandlerProvider; _eventPublishInfoStore = eventPublishInfoStore; _eventHandleInfoStore = eventHandleInfoStore; _eventHandleInfoCache = eventHandleInfoCache; _actionExecutionService = actionExecutionService; _logger = loggerFactory.Create(GetType().Name); _queueList = new List<BlockingCollection<EventProcessingContext>>(); for (var index = 0; index < WorkerCount; index++) { _queueList.Add(new BlockingCollection<EventProcessingContext>(new ConcurrentQueue<EventProcessingContext>())); } _workerList = new List<Worker>(); for (var index = 0; index < WorkerCount; index++) { var queue = _queueList[index]; var worker = new Worker(() => { DispatchEventsToHandlers(queue.Take()); }); _workerList.Add(worker); worker.Start(); } }
/// <summary>Parameterized constructor. /// </summary> /// <param name="waitingCommandService"></param> /// <param name="aggregateRootTypeCodeProvider"></param> /// <param name="aggregateRootFactory"></param> /// <param name="eventStreamConvertService"></param> /// <param name="eventSourcingService"></param> /// <param name="memoryCache"></param> /// <param name="aggregateStorage"></param> /// <param name="retryCommandService"></param> /// <param name="eventStore"></param> /// <param name="eventPublisher"></param> /// <param name="actionExecutionService"></param> /// <param name="eventSynchronizerProvider"></param> /// <param name="loggerFactory"></param> public DefaultCommitEventService( IWaitingCommandService waitingCommandService, IAggregateRootTypeCodeProvider aggregateRootTypeCodeProvider, IAggregateRootFactory aggregateRootFactory, IEventStreamConvertService eventStreamConvertService, IEventSourcingService eventSourcingService, IMemoryCache memoryCache, IAggregateStorage aggregateStorage, IRetryCommandService retryCommandService, IEventStore eventStore, IEventPublisher eventPublisher, IActionExecutionService actionExecutionService, IEventSynchronizerProvider eventSynchronizerProvider, ILoggerFactory loggerFactory) { _waitingCommandService = waitingCommandService; _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider; _aggregateRootFactory = aggregateRootFactory; _eventStreamConvertService = eventStreamConvertService; _eventSourcingService = eventSourcingService; _memoryCache = memoryCache; _aggregateStorage = aggregateStorage; _retryCommandService = retryCommandService; _eventStore = eventStore; _eventPublisher = eventPublisher; _actionExecutionService = actionExecutionService; _eventSynchronizerProvider = eventSynchronizerProvider; _logger = loggerFactory.Create(GetType().Name); }
public TriggerService(IActionExecutionService actionExecutionService, IEvaluateConditionService evaluateConditionService, IJsonDatabaseService memoryEntitiesService, ILogger <TriggerService> logger) { this.actionExecutionService = actionExecutionService; this.evaluateConditionService = evaluateConditionService; this.memoryEntitiesService = memoryEntitiesService; this.logger = logger; }
void IActionCoordinationService.Run(Dictionary <string, Configuration.Action> declaredActions, XmlElement coordinationData) { IActionExecutionService execution = GetService <IActionExecutionService>(true); foreach (Config.Action config in declaredActions.Values) { execution.Execute(config.Name); } }
/// <exclude /> public void ExecuteAction(EntityToken entityToken, ActionToken actionToken) { var flowControllerServicesContainer = GetFlowControllerServicesContainer(); IActionExecutionService actionExecutionService = flowControllerServicesContainer.GetService <IActionExecutionService>(); var taskManagerEvent = new WorkflowCreationTaskManagerEvent(_instanceId); actionExecutionService.Execute(entityToken, actionToken, taskManagerEvent); }
/// <exclude /> protected void ExecuteAction(EntityToken entityToken, ActionToken actionToken) { FlowControllerServicesContainer flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId); IActionExecutionService actionExecutionService = flowControllerServicesContainer.GetService <IActionExecutionService>(); var taskManagerEvent = new WorkflowCreationTaskManagerEvent(_instanceId); actionExecutionService.Execute(entityToken, actionToken, taskManagerEvent); }
/// <summary> /// Runs the coordination using the configuration data specified in the configuration file. /// </summary> /// <param name="declaredActions">Actions defined in the package configuration file for the currently executing recipe.</param> /// <param name="coordinationData">The configuration data used to setup the coordination.</param> public void Run(Dictionary <string, Microsoft.Practices.RecipeFramework.Configuration.Action> declaredActions, XmlElement coordinationData) { IActionExecutionService exec = GetService <IActionExecutionService>(true); int amountCompleted = 0; try { foreach (Microsoft.Practices.RecipeFramework.Configuration.Action action in declaredActions.Values) { amountCompleted++; visualStudio.StatusBar.Progress(true, Properties.Resources.StatusBarProgressMessage, amountCompleted, declaredActions.Values.Count); bool execute = (action.AnyAttr == null || action.AnyAttr.Length == 0); if (!execute) { IDictionaryService dictservice = (IDictionaryService)GetService(typeof(IDictionaryService)); ExpressionEvaluationService evaluator = new ExpressionEvaluationService(); execute = true; foreach (XmlAttribute att in action.AnyAttr) { if (att.Name.Equals(ConditionalCoordinator.ConditionalAttributeName, StringComparison.InvariantCultureIgnoreCase)) { try { execute = (bool)evaluator.Evaluate(att.Value, new ServiceAdapterDictionary(dictservice)); } catch (Exception e) { execute = false; System.Diagnostics.Trace.TraceWarning(Properties.Resources.InvalidConditionException, e.Message, e.StackTrace); } break; } } } if (execute) { Trace.TraceInformation(Properties.Resources.ExecutingAction, action.Name); exec.Execute(action.Name); } } } finally { visualStudio.StatusBar.Progress(false, "", 0, 0); } }
/// <summary>Parameterized constructor. /// </summary> /// <param name="waitingCommandCache"></param> /// <param name="commandHandlerProvider"></param> /// <param name="aggregateRootTypeProvider"></param> /// <param name="commitEventService"></param> /// <param name="actionExecutionService"></param> /// <param name="loggerFactory"></param> public DefaultCommandExecutor( IWaitingCommandCache waitingCommandCache, ICommandHandlerProvider commandHandlerProvider, IAggregateRootTypeCodeProvider aggregateRootTypeProvider, ICommitEventService commitEventService, IActionExecutionService actionExecutionService, ILoggerFactory loggerFactory) { _waitingCommandCache = waitingCommandCache; _commandHandlerProvider = commandHandlerProvider; _aggregateRootTypeProvider = aggregateRootTypeProvider; _commitEventService = commitEventService; _actionExecutionService = actionExecutionService; _logger = loggerFactory.Create(GetType().Name); _commitEventService.SetCommandExecutor(this); }
/// <exclude /> protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { FormsWorkflow formsWorkflow = this.GetRoot <FormsWorkflow>(); FlowControllerServicesContainer flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId); IActionExecutionService actionExecutionService = flowControllerServicesContainer.GetService <IActionExecutionService>(); WorkflowActionToken workflowActionToken = new WorkflowActionToken(this.ChildWorkflowType) { Payload = this.ChildWorkflowPayload, ParentWorkflowInstanceId = formsWorkflow.InstanceId }; actionExecutionService.Execute(formsWorkflow.EntityToken, workflowActionToken, null); return(ActivityExecutionStatus.Closed); }
public void Run(Dictionary <string, Microsoft.Practices.RecipeFramework.Configuration.Action> declaredActions, XmlElement coordinationData) { IActionExecutionService service = base.GetService <IActionExecutionService>(true); int amountCompleted = 0; try { foreach (Microsoft.Practices.RecipeFramework.Configuration.Action action in declaredActions.Values) { amountCompleted++; bool flag = (action.AnyAttr == null) || (action.AnyAttr.Length == 0); if (!flag) { IDictionaryService serviceToAdapt = (IDictionaryService)this.GetService(typeof(IDictionaryService)); ExpressionEvaluationService service3 = new ExpressionEvaluationService(); flag = true; foreach (XmlAttribute attribute in action.AnyAttr) { if (attribute.Name.Equals("Condition", StringComparison.InvariantCultureIgnoreCase)) { try { flag = (bool)service3.Evaluate(attribute.Value, new ServiceAdapterDictionary(serviceToAdapt)); } catch (Exception exception) { flag = false; Trace.TraceWarning("InvalidConditionException", new object[] { exception.Message, exception.StackTrace }); } break; } } } if (flag) { service.Execute(action.Name); } } } finally { this.visualStudio.StatusBar.Progress(false, "", 0, 0); } }
/// <summary> /// Runs the coordination using the configuration data specified in the configuration file. /// </summary> /// <param name="declaredActions">Actions defined in the package configuration file for the currently executing recipe.</param> /// <param name="coordinationData">The configuration data used to setup the coordination.</param> public void Run(Dictionary <string, Config.Action> declaredActions, XmlElement coordinationData) { IActionExecutionService exec = GetService <IActionExecutionService>(true); string currentAction = null; try { foreach (Config.Action action in declaredActions.Values) { currentAction = action.Name; exec.Execute(action.Name); } } catch (Exception e) { IConfigurationService config = GetService <IConfigurationService>(true); DteHelperEx.ShowMessageInOutputWindow( GetService <DTE>(true), string.Format(CultureInfo.CurrentCulture, Properties.Resources.FailSafeCoordinatorExceptionMessage, config.CurrentRecipe.Caption, config.CurrentRecipe.Name, currentAction, e.Message), DteHelperEx.GetPackageFriendlyName(this.Site)); } }