/// <summary>
 /// Enqueues a package into the list of processable packages
 /// </summary>
 /// <param name="package">the package that requires processing</param>
 public void EnqueuePackage(IProcessPackage package)
 {
     lock (processingPackages)
     {
         processingPackages.Add(new PackageSender {
             Package = package, Sent = false
         });
     }
 }
Ejemplo n.º 2
0
        public void EnqueuePackage(IProcessPackage package)
        {
            IIdentity identity = package.LocalConfiguration <IIdentity>("enqueueUser");

            if (!CheckAuthenticatedUser(identity))
            {
                throw new InvalidOperationException("You are not authorized to perform the demanded Action");
            }

            if (package is TPackage)
            {
                EnqueuePackage((TPackage)package);
            }
        }
Ejemplo n.º 3
0
        public async Task <IProcessPackage> EnqueuePackage(IProcessPackage package)
        {
            IIdentity identity = package.LocalConfiguration <IIdentity>("enqueueUser");

            if (!CheckAuthenticatedUser(identity))
            {
                throw new InvalidOperationException("You are not authorized to perform the demanded Action");
            }

            if (package is TPackage pack)
            {
                return(await EnqueuePackage(pack));
            }

            throw new InvalidOperationException("This package type can not be processed by this Server");
        }
        /// <summary>
        /// Enqueues a package on the worker service
        /// </summary>
        /// <param name="package">the package that is supposed to be processed on the working service</param>
        /// <returns></returns>
        private async Task <object> EnqueuePackageOnService(IProcessPackage package)
        {
            var retVal = await client.CallRemoteMethodAsync(remoteObjectName, "EnqueuePackage", new object[] { package });

            return(retVal);
        }
 /// <summary>
 /// Indicates whether the given package was successful
 /// </summary>
 /// <param name="package">the package to Check</param>
 /// <returns>a value indicating whether the package can be considered successful</returns>
 protected virtual bool Success(IProcessPackage package)
 {
     return(true);
 }