Uploaded image for project: 'ActiveMQ .Net'
  1. ActiveMQ .Net
  2. AMQNET-159 Make failover protocol optionally asynchronously connect to sockets
  3. AMQNET-160

Connecting to non-existing host does not raise Exception when using failover protocol

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.0
    • 1.1.0
    • ActiveMQ
    • None
    • Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)

    Description

      When using the failover protocol, there is no exception raised when trying to connect to non-existing host.

      Example:

      using System;
      using System.Collections.Generic;
      using System.Text;
      using Apache.NMS;
      using Apache.NMS.ActiveMQ;

      class ExceptionTest
      {
      private readonly IConnectionFactory oConnfact;
      private readonly IConnection oConn;
      private readonly ISession oSess;
      private readonly IMessageConsumer oConsumer;
      private string sConnectionUri = "failover:(tcp://unknownhost:61612)";

      // Using this connectionstring it does fail.

      //private string sConnectionUri = "tcp://unknownhost:61612";

      public ExceptionTest()

      { oConn.ExceptionListener += new ExceptionListener(OnException); this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID"); oConn.ExceptionListener += new ExceptionListener(OnException); this.oConn = oConnfact.CreateConnection(); oConn.RequestTimeout(new TimeSpan(0, 0, 2)); // Code hangs here oConn.Start(); //Rest does not really mather anymore since it hangs }

      void OnEx(Exception exception)

      { throw new Exception("The method or operation is not implemented."); }

      public void OnException(Exception ex)
      {
      Console.WriteLine("You made a BooBoo:

      {0}

      ", ex.ToString());
      }
      }

      If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur.

      It also seems to ignore the RequestTimeout.

      This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

      Attachments

        Activity

          People

            jgomes Jim Gomes
            mvhoof Michel Van Hoof
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: