예제 #1
0
        /// <summary>
        /// Sends a package to the processing service
        /// </summary>
        /// <param name="package">the package that needs to be processed</param>
        protected void EnqueuePackage(TPackage package)
        {
            if (!CheckConnection())
            {
                throw new InvalidOperationException(ParallellResources.ParallelClient_Not_connected_to_a_service);
            }

            if (package.HasTasks)
            {
                package.RequestingSystem = localSystemIdentifier;

                try
                {
                    var dummy = client.CallRemoteMethod(remoteObjectName,
                                                        ParallellResources.ParallelMethod_EnqueuePackage,
                                                        new object[] { package });
                }
                catch (Exception ex)
                {
                    connected = false;
                    throw new InterProcessException(
                              ParallellResources.ParallelClient_EnqueuePackage_Remote_Call_failed,
                              ex);
                }
            }
            else
            {
                OnPackageProcessed(GetEventData(package, new TTask[0]));
            }
        }
 /// <summary>
 /// Enables a client to commit that it recieved the TaskDone event for a specific package
 /// </summary>
 /// <param name="requestingSystem">the identifier of the requesting system</param>
 /// <param name="packageId">the package identifier for that system</param>
 public void CommitTaskDoneRecieved(string requestingSystem, int packageId)
 {
     lock (unCommittedPackages)
     {
         PackageTrigger psc =
             (from t in unCommittedPackages
              where t.Args.Package.RequestingSystem == requestingSystem && t.Args.Package.Id == packageId
              select t).FirstOrDefault();
         if (psc != null)
         {
             unCommittedPackages.Remove(psc);
             client.CallRemoteMethod(remoteObjectName, "CommitTaskDoneRecieved",
                                     new object[] { requestingSystem, packageId });
         }
     }
 }