private void Init(AsyncCallbackService callbackService = null) { CallbackService = callbackService; _proxyFactory = new ProxyFactory(); DefaultResponseHandler = ((r) => { Logger.Info("AsyncResponseRecieved: {0}", r.PropertiesToString()); }); AsyncWaitTimeout = 1000 * 60 * 5; // 5 minutes }
/// <summary> /// The method executed server side /// </summary> /// <param name="request"></param> public virtual void ExecuteRemoteAsync(AsyncExecutionRequest request) // this should be executing server side after encryption has been handled { Task.Run(() => { AsyncCallbackService asyncCallback = _proxyFactory.GetProxy <AsyncCallbackService>(request.RespondToHostName, request.RespondToPort, Logger); // This executes server side after the SecureChannel has decrypted and validated, need to set IsInitialized to true to // ensure the request doesn't reinitialize to a state where it believes it is an execution request // targeting SecureChannel since that is what is in the HttpContext.Request.Url ExecutionRequest execRequest = new ExecutionRequest { ClassName = request.ClassName, MethodName = request.MethodName, Ext = "json", ServiceProvider = ServiceProvider, JsonParams = request.JsonParams, IsInitialized = true, Context = HttpContext }; bool success = execRequest.Execute(); AsyncExecutionResponse response = new AsyncExecutionResponse { Success = success, Request = request, Result = execRequest.Result }; asyncCallback.RecieveAsyncExecutionResponse(response); }); }
/// <summary> /// The method executed server side /// </summary> /// <param name="request"></param> public virtual void ExecuteRemoteAsync(AsyncExecutionRequest request) // this should be executing server side after encryption has been handled { Task.Run(() => { AsyncCallbackService asyncCallback = _proxyFactory.GetProxy <AsyncCallbackService>(request.RespondToHostName, request.RespondToPort); ExecutionRequest execRequest = new ExecutionRequest(request.ClassName, request.MethodName, "json") { ServiceProvider = ServiceProvider, Context = HttpContext, JsonParams = request.JsonParams }; bool success = execRequest.Execute(); AsyncExecutionResponse response = new AsyncExecutionResponse { Success = success, Request = request, Result = execRequest.Result }; if (!success) { if (execRequest?.Result is ValidationResult validation && validation.Success == false) { response.ValidationFailure = new ValidationFailure { Message = validation.Message, Failures = validation.ValidationFailures }; response.Result = null; } } asyncCallback.RecieveAsyncExecutionResponse(response); }); }
public override object Clone() { AsyncCallbackService clone = new AsyncCallbackService(AsyncCallbackRepository, AppConf); clone.CopyProperties(this); clone.CopyEventHandlers(this); clone._pendingRequests = _pendingRequests; clone._server = _server; clone._serverLock = _serverLock; return(clone); }
public AsyncProxyableService(AsyncCallbackService callbackService, DaoRepository repository, AppConf appConf) : base(repository, appConf) { Init(callbackService); }
public CatalogService(AsyncCallbackService callbackService, DaoRepository repo, AppConf conf) : base(callbackService, repo, conf) { }
public CatalogService(IRepository catalogRepo, AsyncCallbackService callbackService, DaoRepository repo, AppConf conf) : base(callbackService, repo, conf) { Repository = catalogRepo; DaoRepository.WarningsAsErrors = false; DaoRepository.AddReferenceAssemblies(typeof(CoreExtensions).Assembly); }