Exemple #1
0
        private IEsbExecutionContainer GenerateContainer(ServiceAction serviceAction, IDSFDataObject dataObj, IWorkspace theWorkspace)
        {
            // set the ID for later use ;)
            dataObj.WorkspaceID = _workspace.ID;

            IEsbExecutionContainer result = null;

            if (dataObj.IsServiceTestExecution)
            {
                result = new ServiceTestExecutionContainer(serviceAction, dataObj, _workspace, _esbChannel, _request);
            }
            else
            {
                switch (serviceAction.ActionType)
                {
                case enActionType.InvokeManagementDynamicService:
                    result = new InternalServiceContainer(serviceAction, dataObj, theWorkspace, _esbChannel, _request);
                    break;

                case enActionType.InvokeWebService:
                    result = new WebServiceContainer(serviceAction, dataObj, theWorkspace, _esbChannel);
                    break;

                case enActionType.Workflow:
                    result = new PerfmonExecutionContainer(new WfExecutionContainer(serviceAction, dataObj, theWorkspace, _esbChannel));
                    break;

                case enActionType.RemoteService:
                    result = new RemoteWorkflowExecutionContainer(serviceAction, dataObj, null, _esbChannel);
                    break;
                }
            }
            return(result);
        }
 public PerfmonExecutionContainer(IEsbExecutionContainer container)
 {
     VerifyArgument.IsNotNull(nameof(Container), container);
     _container           = container;
     _locater             = CustomContainer.Get <IWarewolfPerformanceCounterLocater>();
     _recPerSecondCounter = _locater.GetCounter("Request Per Second");
     _currentConnections  = _locater.GetCounter("Concurrent requests currently executing");
     _avgTime             = _locater.GetCounter("Average workflow execution time");
     _totalErrors         = _locater.GetCounter("Total Errors");
     _stopwatch           = new Stopwatch();
     _stopwatch.Start();
 }
Exemple #3
0
 private void ConfigureDataListIfRemote(IEsbExecutionContainer executionContainer)
 {
     if (!_isLocal && executionContainer is RemoteWorkflowExecutionContainer remoteContainer)
     {
         var fetchRemoteResource = remoteContainer.FetchRemoteResource(_dataObject.ResourceID, _dataObject.ServiceName, _dataObject.IsDebugMode());
         if (fetchRemoteResource != null)
         {
             fetchRemoteResource.DataList = fetchRemoteResource.DataList.Replace(GlobalConstants.SerializableResourceQuote, "\"").Replace(GlobalConstants.SerializableResourceSingleQuote, "'");
             var remoteDataList = fetchRemoteResource.DataList;
             _dataObject.RemoteInvokeResultShape = new StringBuilder(remoteDataList);
             _dataObject.ServiceName             = fetchRemoteResource.ResourceCategory;
         }
         else
         {
             var message = string.Format(ErrorResource.ServiceNotFound, _dataObject.ServiceName);
             _errors.AddError(message);
         }
     }
 }
 static void SetRemoteExecutionDataList(IDSFDataObject dataObject, IEsbExecutionContainer executionContainer, ErrorResultTO errors)
 {
     if (executionContainer is RemoteWorkflowExecutionContainer remoteContainer)
     {
         var fetchRemoteResource = remoteContainer.FetchRemoteResource(dataObject.ResourceID, dataObject.ServiceName, dataObject.IsDebugMode());
         if (fetchRemoteResource != null)
         {
             fetchRemoteResource.DataList = fetchRemoteResource.DataList.Replace(GlobalConstants.SerializableResourceQuote, "\"").Replace(GlobalConstants.SerializableResourceSingleQuote, "'");
             var remoteDataList = fetchRemoteResource.DataList;
             dataObject.RemoteInvokeResultShape = new StringBuilder(remoteDataList);
             dataObject.ServiceName             = fetchRemoteResource.ResourceCategory;
         }
         else
         {
             var message = string.Format(ErrorResource.ServiceNotFound, dataObject.ServiceName);
             errors.AddError(message);
         }
     }
 }
Exemple #5
0
        private IEsbExecutionContainer GenerateInvokeContainerAndCache(IDSFDataObject dataObject, string serviceName)
        {
            var resourceId = dataObject.ResourceID;

            Dev2Logger.Debug($"Getting DynamicService: {serviceName}", dataObject.ExecutionID.ToString());
            var theService = GetService(serviceName, resourceId);
            IEsbExecutionContainer executionContainer = null;

            if (theService != null && theService.Actions.Any())
            {
                var sa = theService.Actions.FirstOrDefault();
                if (sa != null)
                {
                    MapServiceActionDependencies(sa);
                    sa.Service = theService;
                    _cache.TryAdd(dataObject.ResourceID, sa);
                    executionContainer = GenerateContainer(sa, dataObject, _workspace);
                }
            }

            return(executionContainer);
        }
Exemple #6
0
        /// <summary>
        /// Generates the invoke container.
        /// </summary>
        /// <param name="dataObject">The data object.</param>
        /// <param name="serviceName">Name of the service.</param>
        /// <param name="isLocalInvoke">if set to <c>true</c> [is local invoke].</param>
        /// <param name="masterDataListId">The master data list unique identifier.</param>
        /// <returns></returns>
        public IEsbExecutionContainer GenerateInvokeContainer(IDSFDataObject dataObject, string serviceName, bool isLocalInvoke, Guid masterDataListId = default(Guid))
        {
            if (isLocalInvoke)
            {
                if (_cache.ContainsKey(dataObject.ResourceID))
                {
                    ServiceAction sa = _cache[dataObject.ResourceID];

                    return(GenerateContainer(sa, dataObject, _workspace));
                }
                // ReSharper disable RedundantIfElseBlock
                else
                // ReSharper restore RedundantIfElseBlock
                {
                    var                    resourceId         = dataObject.ResourceID;
                    DynamicService         theService         = GetService(serviceName, resourceId);
                    IEsbExecutionContainer executionContainer = null;


                    if (theService != null && theService.Actions.Any())
                    {
                        var sa = theService.Actions.FirstOrDefault();
                        if (sa != null)
                        {
                            MapServiceActionDependencies(sa);
                            sa.Service = theService;
                            _cache.TryAdd(dataObject.ResourceID, sa);
                            executionContainer = GenerateContainer(sa, dataObject, _workspace);
                        }
                    }

                    return(executionContainer);
                }
            }
            return(GenerateContainer(new ServiceAction {
                ActionType = enActionType.RemoteService
            }, dataObject, null));
        }