The reply message from a worker process.
Beispiel #1
0
        /// <summary>
        /// Processes worker process requests.
        /// </summary>
        public static WorkerProcessResponse ProcessRequest(WorkerProcessRequest request)
        {
            var engine = new ScriptEngine();

            var response = new WorkerProcessResponse();
            try
            {
                // Execute the provided script.
                object result = engine.Evaluate(request.Script);
                response.JsonResult = JSONObject.Stringify(engine, result);
            }
            catch (Exception e)
            {
                // There was an error.
                response.ErrorType = e.GetType().Name;
                response.ErrorMessage = e.Message;
            }

            return response;
        }
Beispiel #2
0
        /// <summary>
        /// Processes worker process requests.
        /// </summary>
        public static WorkerProcessResponse ProcessRequest(WorkerProcessRequest request)
        {
            var engine = new ScriptEngine();

            var response = new WorkerProcessResponse();

            try
            {
                // Execute the provided script.
                object result = engine.Evaluate(request.Script);
                response.JsonResult = JSONObject.Stringify(engine, result);
            }
            catch (Exception e)
            {
                // There was an error.
                response.ErrorType    = e.GetType().Name;
                response.ErrorMessage = e.Message;
            }

            return(response);
        }