Exemple #1
0
        internal MessageState ExecSet(QueueMessage request)
        {
            try
            {
                if (request == null)
                {
                    throw new ArgumentNullException("QueueManager.ExecSet message");
                }
                if (request.Host == null)// || message.Host.Count == 0)
                {
                    throw new ArgumentNullException("QueueManager.ExecSet message.Host is invalid");
                }

                MQueue Q = Get(request.Host);
                if (Q == null)
                {
                    throw new MessageException(MessageState.InvalidMessageHost, "message.Host is invalid " + request.Host);
                }

                Q.Enqueue(request.GetQueueItem());

                //TODO: DISTREBUTING TO HOSTS LIST


                //foreach (var host in request.Host)
                //{
                //    if (host.IsLocal)
                //    {
                //        MQueue Q = Get(host.HostName);
                //        if (Q == null)
                //        {
                //            throw new MessageException(MessageState.InvalidMessageHost, "message.Host is invalid " + message.Host);
                //        }
                //            Q.Enqueue(item);
                //    }
                //    else
                //    {
                //        //TODO:not supported
                //        throw new Exception("Host not IsLocal not supported!");
                //    }
                //}
            }
            catch (MessageException mex)
            {
                QLogger.ErrorFormat("ExecSet MessageException: " + mex.Message);
                return(MessageState.MessageError);
            }
            catch (ArgumentException ase)
            {
                QLogger.ErrorFormat("ExecSet ArgumentException: " + ase.Message);
                return(MessageState.ArgumentsError);
            }
            catch (SerializationException se)
            {
                QLogger.ErrorFormat("ExecSet SerializationException: " + se.Message);
                return(MessageState.SerializeError);
            }
            catch (Exception ex)
            {
                QLogger.ErrorFormat("ExecSet Exception: " + ex.Message);
                return(MessageState.UnExpectedError);
            }
            return(MessageState.Ok);
        }