You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Jim Gomes (JIRA)" <ji...@apache.org> on 2009/05/22 20:14:51 UTC

[jira] Resolved: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

     [ https://issues.apache.org/activemq/browse/AMQNET-160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jim Gomes resolved AMQNET-160.
------------------------------

    Resolution: Working as Designed

In this scenario, the failover protocol is working as designed.  The non-existent server could very well have been a server that failed, and the client is waiting for it to come back up.  While the server is being repaired, it will appear to be "non-existent".  However, an exception should not be thrown.  The failover logic should be applied.  If there were multiple servers listed in the failover URI, then it would move to the next server in the list and an exception should not be thrown.  Since an exception is thrown when not using failover, then this is working correctly.  If the server that is being attempted to be connected to truly does not exist, then this would be considered a configuration error, and not an NMS bug.

> Connecting to non-existing host does not raise Exception when using failover protocol
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-160
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.0
>         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
>             Fix For: 1.1
>
>
> 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).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.