public void DestinationTestNoException()
 {
     String host = "http://test.at";
     String queue = "TestCase1";
     Destination destination = new Destination(host + "?" + queue);
     Assert.AreEqual(host, destination.Host);
     Assert.AreEqual(queue, destination.Queue);
     Assert.AreEqual(host + "?" + queue, destination.FullDestination);
 }
 public void DestinationTestException()
 {
     String host = "http://test.at";
     String queue = "TestCase1";
     try
     {
         Destination destination = new Destination(host + "!" + queue);
         Assert.Fail();
     }
     catch (ApplicationException) { }
 }
Exemple #3
0
        /// <summary>
        /// Configurate the Connection
        /// </summary>
        /// <param name="destination">Destionation</param>
        protected void Configure()
        {
            if (close) return;
            if (nbrretry++ >= maxretries)
                handling = EExceptionHandling.ForwardException;

            try
            {
                Destination dest = new Destination(string_destination);
                Uri connectionUri = new Uri(dest.Host);
                factory = new Apache.NMS.ActiveMQ.ConnectionFactory(connectionUri);
                connection = factory.CreateConnection();
                session = connection.CreateSession();
                connection.Start();
                this.destination = session.GetDestination(dest.Queue);
                nbrretry = 0;
            }
            catch
            {
                switch (handling)
                {
                    case EExceptionHandling.ForwardException:
                        {
                            throw;
                        }
                    case EExceptionHandling.Retry:
                        {
                            Configure();
                            break;
                        }
                }
            }
        }