public Task <T> callMessageHandlerAsync <T>(IInfoContext info, FunctionContext context) { MessageHandler messageHandler = getMessageHandler(info.TypeApplication, context.type); return(callFunctionAsync <T>(messageHandler, info, context)); }
public static FunctionContext AddType(this FunctionContext fctx, Enum e) { fctx.type = e.ToString(); return(fctx); }
/// <summary> /// FunctionContext copy /// </summary> /// <param name="context"> il contesto di esecuzione da copiare. </param> public FunctionContext(FunctionContext context) { this.msg = context.msg; this.type = context.type; this._mapIndex = new Dictionary <string, object>(context._mapIndex); }
public static FunctionContext NewFunctionContext(Enum e) { FunctionContext fctx = new FunctionContext(type: e.ToString()); return(fctx); }
public static FunctionContext NewFunctionContext(Enum e, string msg) { FunctionContext fctx = new FunctionContext(type: e.ToString(), msg: msg); return(fctx); }
/// <summary> /// Call an Async Message Handler by FunctionContext.Type /// </summary> public virtual Task <T> CallMessageHandlerAsync <T>(FunctionContext context) { return(functionCaller.callMessageHandlerAsync <T>(this.infoctx, context)); }
/// <summary> /// Call a Message Handler by FunctionContext.Type /// </summary> public virtual T CallMessageHandler <T>(FunctionContext context) { return((T)functionCaller.callMessageHandler(this.infoctx, context)); }
public virtual void DispatchToScheduledExecution(FunctionContext context) { functionCaller.dispatchMessageToScheduledExecution(context); }
/// <summary> /// Dispatch a message(FunctionContext) to listener by FunctionContext.Type /// </summary> public virtual Dictionary <string, object> DispatchToListeners(FunctionContext context) { return(functionCaller.dispatchMessageToListeners(context)); }
public abstract Task <T2> addContextToAsyncQueue(FunctionContext fctx);
/// <summary> /// Async Dispatch a message(FunctionContext) to listener by FunctionContext.Type /// </summary> public virtual Dictionary <string, Task <object> > DispatchAsyncToListenersGetTasks(FunctionContext context) { return(functionCaller.dispatchMessageToAsyncListenersGetTasks(context)); }
public abstract override object addContextToQueue(FunctionContext fctx);
public virtual Dictionary <string, Task <object> > dispatchMessageToAsyncListenersGetTasks(FunctionContext context) { Dictionary <string, Task <object> > tasksDict = new Dictionary <string, Task <object> >(); if (listenerMapDataType.ContainsKey(context.type)) { for (int i = 0; i < listenerMapDataType[context.type].Count; i++) { #if DEBUG Stopwatch timeOperations = Stopwatch.StartNew(); #endif AbstractListener ablistworker = (AbstractListener)listenerMapDataType[context.type][i]; try { Task <object> task; if (ablistworker.isAsyncMethod() || ablistworker.isYieldMethod()) { if (main.infoctx.DebugMode) { getLogger().Debug("Calling Async dispatch " + ablistworker.getName()); } task = ablistworker.addContextToGenericAsyncQueue(context); } else { if (main.infoctx.DebugMode) { getLogger().Debug("Calling Awaitable dispatch " + ablistworker.getName()); } task = Task.Run <object>(async() => { return(await ablistworker.addContextToGenericAsyncQueue(context)); }); } tasksDict.Add(ablistworker.getName(), task); } finally { #if DEBUG timeOperations.Stop(); getLogger().Debug("Dispatched MessageAsync to " + ablistworker.getName() + " in " + timeOperations.ElapsedMilliseconds + "ms"); #endif } } } else { getLogger().Warning("Not Found listener for " + context.type); } return(tasksDict); }
public object callMessageHandler(IInfoContext info, FunctionContext context) { MessageHandler messageHandler = getMessageHandler(info.TypeApplication, context.type); return(callFunction(messageHandler, info, context)); }
/// <summary> /// Starts the Task, scheduling it for execution to the current TaskScheduler. /// </summary> /// <param name="functionName"> Function Name. </param> /// <param name="context"> Params that can be passed to the function using FunctionContext. </param> /// <param name="info"> Class that implements IInfoContext. </param> public virtual void CallSynchronizedTaskFunction(string functionName, IInfoContext info, FunctionContext context) { WorkerTask asyncWorker = new WorkerTask(this, info, functionName, context); asyncWorker.init(); Task runner = new Task(asyncWorker.run); runner.Start(); //return runner; //return Task.Run(() => asyncWorker.run()); }
public virtual Task <object> DispatchAsyncToSingleListener(FunctionContext ctx, string functionName) { return(functionCaller.dispatchMessageToAsyncSingleListener(ctx, functionName)); }
/// <summary> /// Starts the Task, scheduling it for execution to the current TaskScheduler. /// <seealso cref="callThreadFunction( functionName, info, context)"/> /// </summary> public virtual void CallSynchronizedTaskFunction(string functionName, FunctionContext context) { CallSynchronizedTaskFunction(functionName, this.infoctx, context); }
public virtual void DispatchToScheduledExecution(FunctionContext ctx, string functionName) { functionCaller.dispatchMessageToSingleScheduledExecution(ctx, functionName); }
/// <summary> /// Call a Message Handler by FunctionContext.Type /// </summary> public virtual object CallMessageHandler(FunctionContext context) { return(functionCaller.callMessageHandler(this.infoctx, context)); }
public virtual object DispatchToSingleListener(FunctionContext ctx, string functionName) { return(functionCaller.dispatchMessageToSingleListener(ctx, functionName)); }
public static FunctionContext NewFunctionContext() { FunctionContext fctx = new FunctionContext(); return(fctx); }
/// <summary> /// Call A Function in Async /// </summary> /// <param name="functionName"> Function Name. </param> /// <param name="context"> Params that can be passed to the function using FunctionContext. </param> /// <param name="info"> Class that implements IInfoContext. </param> public virtual Task <T> CallFunctionAsync <T>(string functionName, IInfoContext info, FunctionContext context) { return(functionCaller.callFunctionAsync <T>(functionName, info, context)); }
public static FunctionContext NewFunctionContext(string type, string msg) { FunctionContext fctx = new FunctionContext(type: type, msg: msg); return(fctx); }
/// <summary> /// Call a Regular Function /// <seealso cref="callFunction(functionName,info,context)"/> /// </summary> public virtual T CallFunction <T>(string functionName, FunctionContext context) { return(CallFunction <T>(functionName, this.infoctx, context)); }
public static FunctionContext AddType(this FunctionContext fctx, string newtype) { fctx.type = newtype; return(fctx); }
/// <summary> /// Call a Regular Function /// </summary> /// <param name="functionName"> Function Name. </param> /// <param name="context"> Params that can be passed to the function using FunctionContext. </param> /// <param name="info"> Class that implements IInfoContext. </param> /// <returns>Return an object result</returns> public virtual object CallFunction(string functionName, IInfoContext info, FunctionContext context) { return(functionCaller.callFunction(functionName, info, context)); }
public static FunctionContext AddParam(this FunctionContext fctx, string sindex, object param) { fctx.setParam(sindex, param); return(fctx); }
/// <summary> /// Call a Regular Function /// <seealso cref="callFunction(functionName,info,context)"/> /// </summary> public virtual object CallFunction(string functionName, FunctionContext context) { return(CallFunction(functionName, this.infoctx, context)); }
/// <summary> /// add async at abstract function /// </summary> public abstract override Task <T> executeGenericAsync <T>(IInfoContext info, FunctionContext context);
/// <summary> /// Chiama una funzione. /// </summary> /// <param name="function"> la funzione da chiamare. </param> /// <param name="worker"> il worker che sta eseguendo la sessione. </param> /// <param name="context"> il contesto della chiamata. /// /// @return il risultato della chiamata. /// </param> /// <exception cref="FunctionNotFoundException"> se la classe non � definita nel sistema. </exception> /// <exception cref="Exception"> se si verifica un errore. </exception> public Task <T> callFunctionAsync <T>(EnterpriseFunction function, IInfoContext info, FunctionContext context) { #if DEBUG Stopwatch timeOperations = Stopwatch.StartNew(); #endif try { if (function.isAsyncMethod() || function.isYieldMethod()) { if (main.infoctx.DebugMode) { getLogger().Debug("Calling Async function " + function.getName()); } return(function.executeGenericAsync <T>(info, context)); } else { if (main.infoctx.DebugMode) { getLogger().Debug("Calling Awaitable function " + function.getName()); } var t = Task.Run <T>(async() => { return(await function.executeGenericAsync <T>(info, context)); }); return(t); } } finally { #if DEBUG timeOperations.Stop(); getLogger().Debug("Called functionAsync " + function.getName() + " in " + timeOperations.ElapsedMilliseconds + "ms"); #endif } }