Example #1
0
        internal IQueueItem ExecGet(IQueueMessage request)
        {
            if (request.Host == null)
            {
                throw new MessageException(MessageState.InvalidMessageHost, "Invalid message.Host ");
            }
            MQueue Q = Get(request.Host);

            if (Q == null)
            {
                throw new MessageException(MessageState.InvalidMessageHost, "message.HostName not found " + request.Host);
            }
            switch (request.QCommand)
            {
            case QueueCmd.Dequeue:
                return(Q.Dequeue());

            case QueueCmd.DequeuePriority:
                return(Q.Dequeue(request.Priority));

            case QueueCmd.Peek:
                return(Q.Peek());

            case QueueCmd.PeekPriority:
                return(Q.Peek(request.Priority));
            }

            return(null);
        }
Example #2
0
        internal IQueueItem ExecGet(QueueMessage request)
        {
            try
            {
                MQueue Q = Get(request.Host);
                if (Q == null)
                {
                    throw new MessageException(MessageState.InvalidMessageHost, "message.Host is invalid " + request.Host);
                }
                switch (request.Command)
                {
                case QueueCmd.Dequeue:
                    return(Q.Dequeue());

                case QueueCmd.DequeuePriority:
                    return(Q.Dequeue(request.Priority));

                case QueueCmd.Peek:
                    return(Q.Peek());

                case QueueCmd.PeekPriority:
                    return(Q.Peek(request.Priority));
                }
            }
            catch (MessageException mex)
            {
                QLogger.ErrorFormat("ExecGet MessageException: " + mex.Message);
            }
            catch (ArgumentException ase)
            {
                QLogger.ErrorFormat("ExecGet ArgumentException: " + ase.Message);
            }
            catch (SerializationException se)
            {
                QLogger.ErrorFormat("ExecGet SerializationException: " + se.Message);
            }
            catch (Exception ex)
            {
                QLogger.ErrorFormat("ExecGet Exception: " + ex.Message);
            }
            return(null);
        }