Ejemplo n.º 1
0
        public RequestHandle ExecuteTask(Task task)
        {
            // create a new request handle
            RequestHandle handle = new RequestHandle();
            handle.Handle = String.Format("TB-{0}-{1}", Environment.MachineName,  Guid.NewGuid().ToString());
            _taskRequestHandleMap[task.TaskId] = handle;            
            handle.TaskStatus = TaskStatus.Queued;

            // enqueue the task
            _executeQueue.Enqueue(task);

            return handle;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Execute the method specified in the task.
        /// If the task-object contains an object-host pair data, then the method
        /// will be executed on that object - otherwise, a brand new non-persistent
        /// object of the type specified in the task will be created and the method
        /// will be executed in that object.
        /// </summary>
        /// <returns>task request handle</returns>
        public RequestHandle ExecuteTask(Task task)
        {
            _log.InfoFormat("Received execute request for task: {0}", task.TaskId);

            // create a new request handle
            RequestHandle handle = new RequestHandle();
            handle.Handle = String.Format("TB-{0}-{1}", Environment.MachineName, Guid.NewGuid().ToString());
            _taskRequestHandleMap[task.TaskId] = handle;
            _handleCallbackMap[handle.Handle] = OperationContext.Current.GetCallbackChannel<ITaskBrokerCallback>();
            handle.TaskStatus = TaskStatus.Queued;

            // enqueue the task
            _executeQueue.Enqueue(task);
            _waitTillExecuteQueueHasTasks.Set();
            _log.DebugFormat("Task {0} enqueued with handle: {1}", task.TaskId, handle.Handle);
            return handle;
        }