Пример #1
0
        public void MoveErrorMessageToOriginQueue(QueueItem itm)
        {
            if (string.IsNullOrEmpty(itm.Id))
            {
                throw new ArgumentException("MessageId can not be null or empty");
            }

            if (itm.Queue.Type != QueueType.Error)
            {
                throw new ArgumentException("Queue is not of type Error, " + itm.Queue.Type);
            }

            var mgr = new ErrorManager();

            // TODO:
            // Check if Clustered Queue, due if Clustered && NonTransactional, then Error

            //var deserializer = new XmlMessageSerializer();

            XmlMessageSerializer _serializer = new XmlMessageSerializer();

            using (var stream = new MemoryStream(UTF8Encoding.Default.GetBytes(itm.Content ?? "")))
            {
                var rcx = ReceiveContext.FromBodyStream(stream);
                _serializer.Deserialize(rcx);

                //var query = rcx.DestinationAddress.Query;

                //var errorQueue = rcx.DestinationAddress.OriginalString.Replace(query, "") + "_error";

                //mgr.InputQueue = new EndpointAddress(errorQueue);

                mgr.ReturnMessageToSourceQueue(itm.Id, rcx);
            }
        }
		public void MoveErrorMessageToOriginQueue(QueueItem itm)
		{
			if (string.IsNullOrEmpty(itm.Id))
				throw new ArgumentException("MessageId can not be null or empty");

			if (itm.Queue.Type != QueueType.Error)
				throw new ArgumentException("Queue is not of type Error, " + itm.Queue.Type);

			var mgr = new ErrorManager();

			// TODO:
			// Check if Clustered Queue, due if Clustered && NonTransactional, then Error

			mgr.InputQueue = Address.Parse(itm.Queue.Name);

			mgr.ReturnMessageToSourceQueue(itm.Id);
		}
        public void MoveErrorMessageToOriginQueue(QueueItem itm)
        {
            if (string.IsNullOrEmpty(itm.Id))
            {
                throw new ArgumentException("MessageId can not be null or empty");
            }

            if (itm.Queue.Type != QueueType.Error)
            {
                throw new ArgumentException("Queue is not of type Error, " + itm.Queue.Type);
            }

            var mgr = new ErrorManager();

            // TODO:
            // Check if Clustered Queue, due if Clustered && NonTransactional, then Error

            mgr.InputQueue = Address.Parse(itm.Queue.Name);

            mgr.ReturnMessageToSourceQueue(itm.Id);
        }
        public void MoveErrorMessageToOriginQueue(QueueItem itm)
        {
            if (string.IsNullOrEmpty(itm.Id))
                throw new ArgumentException("MessageId can not be null or empty");

            if (itm.Queue.Type != QueueType.Error)
                throw new ArgumentException("Queue is not of type Error, " + itm.Queue.Type);

            var mgr = new ErrorManager();

            // TODO:
            // Check if Clustered Queue, due if Clustered && NonTransactional, then Error

            //var deserializer = new XmlMessageSerializer();

            XmlMessageSerializer _serializer = new XmlMessageSerializer();

            using (var stream = new MemoryStream(UTF8Encoding.Default.GetBytes(itm.Content ?? "")))
            {
                var rcx = ReceiveContext.FromBodyStream(stream);
                _serializer.Deserialize(rcx);

                //var query = rcx.DestinationAddress.Query;

                //var errorQueue = rcx.DestinationAddress.OriginalString.Replace(query, "") + "_error";

                //mgr.InputQueue = new EndpointAddress(errorQueue);

                mgr.ReturnMessageToSourceQueue(itm.Id, rcx);
            }
        }