void ExecuteRequestAsync(IDSFDataObject dataObject, string inputDefs, IEsbServiceInvoker invoker, bool isLocal, Guid oldID, out ErrorResultTO invokeErrors, int update) { var clonedDataObject = dataObject.Clone(); invokeErrors = new ErrorResultTO(); var executionContainer = invoker.GenerateInvokeContainer(clonedDataObject, clonedDataObject.ServiceName, isLocal, oldID); if (executionContainer != null) { if (!isLocal) { var remoteContainer = executionContainer as RemoteWorkflowExecutionContainer; if (remoteContainer != null) { if (!remoteContainer.ServerIsUp()) { invokeErrors.AddError("Asynchronous execution failed: Remote server unreachable"); } SetRemoteExecutionDataList(dataObject, executionContainer, invokeErrors); } } if (!invokeErrors.HasErrors()) { var shapeDefinitionsToEnvironment = DataListUtil.InputsToEnvironment(dataObject.Environment, inputDefs, update); Task.Factory.StartNew(() => { Dev2Logger.Log.Info("ASYNC EXECUTION USER CONTEXT IS [ " + Thread.CurrentPrincipal.Identity.Name + " ]"); ErrorResultTO error; clonedDataObject.Environment = shapeDefinitionsToEnvironment; executionContainer.Execute(out error, update); return(clonedDataObject); }).ContinueWith(task => { if (task.Result != null) { task.Result.Environment = null; } }); } } else { invokeErrors.AddError("Asynchronous execution failed: Resource not found"); } }
public EsbServicesEndpointMock(IEsbServiceInvoker esbServiceInvoker) { VerifyArgument.IsNotNull("esbServiceInvoker", esbServiceInvoker); _esbServiceInvoker = esbServiceInvoker; }
void ExecuteRequestAsync(IDSFDataObject dataObject, IDataListCompiler compiler, IEsbServiceInvoker invoker, bool isLocal, Guid oldID, out ErrorResultTO invokeErrors) { var clonedDataObject = dataObject.Clone(); StringBuilder dl1 = compiler.ConvertFrom(dataObject.DataListID, DataListFormat.CreateFormat(GlobalConstants._XML_Without_SystemTags), enTranslationDepth.Data, out invokeErrors); var shapeOfData = FindServiceShape(dataObject.WorkspaceID, dataObject.ResourceID); var executionContainer = invoker.GenerateInvokeContainer(clonedDataObject, clonedDataObject.ServiceName, isLocal, oldID); if (executionContainer != null) { if (!isLocal) { var remoteContainer = executionContainer as RemoteWorkflowExecutionContainer; if (remoteContainer != null) { if (!remoteContainer.ServerIsUp()) { invokeErrors.AddError("Asynchronous execution failed: Remote server unreachable"); } SetRemoteExecutionDataList(dataObject, executionContainer); shapeOfData = dataObject.RemoteInvokeResultShape; } } if (!invokeErrors.HasErrors()) { var task = Task.Factory.StartNew(() => { Dev2Logger.Log.Info("ASYNC EXECUTION USER CONTEXT IS [ " + Thread.CurrentPrincipal.Identity.Name + " ]"); ErrorResultTO error; clonedDataObject.DataListID = compiler.ConvertTo(DataListFormat.CreateFormat(GlobalConstants._XML_Without_SystemTags), dl1, shapeOfData, out error); executionContainer.Execute(out error); }); // ReSharper disable ImplicitlyCapturedClosure task.ContinueWith(o => // ReSharper restore ImplicitlyCapturedClosure { DataListRegistar.DisposeScope(o.Id, clonedDataObject.DataListID); o.Dispose(); }); } } else { invokeErrors.AddError("Asynchronous execution failed: Resource not found"); } }