/// <summary> /// Returns current processing state or result after completion. /// To avoid polling pass callback URI when invoking Execute method. /// </summary> /// <param name="eid">Identifier of executor.</param> /// <returns>Remote executor state.</returns> public RemoteExecutorServiceResult TryJoin(Guid eid) { var executor = GetExecutor(eid); var result = new RemoteExecutorServiceResult { ElapsedTime = executor.ElapsedTime, ExecutorState = executor.ExecutorState }; // TODO: Should dispose on request? switch (executor.ExecutorState) { case ExecutorState.Finished: result.Result = executor.SerializedResult; // we have to make sure that the message with the result is not lost DisposeExecutor(executor); break; case ExecutorState.Faulted: result.Error = executor.Exception; DisposeExecutor(executor); break; } return result; }
/// <summary> /// Called in response to Execute after processing has finished. /// </summary> /// <param name="eid">Executor identifier</param> /// <param name="executeResult">Executor processing result.</param> public void ExecuteCallback(Guid eid, RemoteExecutorServiceResult executeResult) { Log.TraceMessage(Log.Activity.Received_execute_callback,string.Format("Received execute callback."), Log.MessageType.Trace, eid.EidAsLogKeywords()); var executor = GetRemoteExecutor(eid); executor.Pulse(executeResult.Convert()); }