XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.1.0
    • 1.1.0
    • ActiveMQ
    • None
    • 1. ActiveMQ on linux CentOS 4.4
      2. Client on Mono 1.9 on linux CentOS 4.4

    Description

      I'm using ActiveMQ .Net to connect to ActiveMQ from Mono application on linux.
      I've downloaded new (12-12-2008, rev. 726083) version of ActiveMQ .Net and started from testing new feature: FAILOVER transport.
      First test made on Windows were very promising, but trying to run my application on linux caused an error.
      I've invested it a bit and found out this:
      On linux Mono the System.Uri constructor causes error while parsing composite uri, because it replaces all '//' with '/'. And tries to connect to 'tcp:/localhost:61616' for example.

      I've tested it on newest Mono 2.0 SUSE with the same result.

      Uris, I've tried:
      failover:(tcp://192.168.44.244:61616)
      failover:(tcp://192.168.44.244:61616)/
      failover://localhost/(tcp://192.168.44.244:61616)
      failover://localhost/(tcp://192.168.44.244:61616)/

      All with the same result (

      Illustration.
      I modified Apache.NMS.ActiveMQ.ConnectionFactory constructors as below:
      (...)
      public ConnectionFactory(string brokerUri, string clientID)
      : this(new Uri(brokerUri), clientID)

      { Tracer.Debug("ConnectionFactory(string brokerUri, string clientID): brokerUri='" + brokerUri + "'"); }

      (...)
      public ConnectionFactory(Uri brokerUri, string clientID)

      { Tracer.Debug("ConnectionFactory(Uri brokerUri, string clientID): brokerUri='" + brokerUri + "'"); this.brokerUri = brokerUri; this.clientId = clientID; }

      (...)

      and prepare simple islustrating program:

      using System;
      using Apache.NMS;
      using Apache.NMS.ActiveMQ;

      namespace IssueExample
      {
      internal class ConsoleTracer : ITrace
      {
      public bool IsDebugEnabled { get

      { return true; } }
      public bool IsInfoEnabled { get { return true; }

      }
      public bool IsWarnEnabled { get

      { return true; } }
      public bool IsErrorEnabled { get { return true; }

      }
      public bool IsFatalEnabled { get

      { return true; }

      }
      public void Debug(string message)

      { Console.WriteLine("DEBUG:" + message); }

      public void Info(string message)

      { Console.WriteLine("INFO:" + message); }

      public void Warn(string message)

      { Console.WriteLine("WARN:" + message); }

      public void Error(string message)

      { Console.WriteLine("ERROR:" + message); }

      public void Fatal(object message)

      { Console.WriteLine("FATAL:" + message); }

      }

      class Program
      {
      public static void Main(string[] args)

      { Tracer.Trace = new ConsoleTracer(); IConnectionFactory factory = new ConnectionFactory(args[0]); IConnection connection = factory.CreateConnection(); connection.Close(); Console.WriteLine("Connected and Disconnected successfully to '" + args[0] + "'"); Console.ReadKey(); }

      }
      }

      Running my program the output was:

      1. mono IssueExample.exe failover://localhost/(tcp://192.168.44.244:61616\,tcp://192.168.44.244:61616)/
        DEBUG:ConnectionFactory(Uri brokerUri, string clientID): brokerUri='failover://localhost/(tcp:/192.168.44.244:61616,tcp:/192.168.44.244:61616)/'
        DEBUG:ConnectionFactory(string brokerUri, string clientID): brokerUri='failover://localhost/(tcp://192.168.44.244:61616,tcp://192.168.44.244:61616)/'
        DEBUG:Reconnect was triggered but transport is not started yet. Wait for start to connect the transport.
        DEBUG:Started.
        DEBUG:Creating reconnect task
        DEBUG:Waking up reconnect task
        INFO:Waiting for transport to reconnect.
        DEBUG:Attempting connect to: tcp:/192.168.44.244:61616
        DEBUG:Opening socket to: on port: -1
        DEBUG:Connect fail to: tcp:/192.168.44.244:61616, reason: System.ArgumentOutOfRangeException: Argument is out of range.
        Parameter name: Invalid port
        at System.Net.IPEndPoint.set_Port (Int32 value) [0x00000]
        at System.Net.IPEndPoint..ctor (System.Net.IPAddress address, Int32 port) [0x00000]
        at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.Connect (System.String host, Int32 port) [0x00000]
        at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.CompositeConnect (System.Uri location) [0x00000]
        at Apache.NMS.ActiveMQ.Transport.TransportFactory.CompositeConnect (System.Uri location) [0x00000]
        at Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.doReconnect () [0x00000]
        DEBUG:Waiting 10 ms before attempting connection.
        (...)
        <Infinit loop of reconnects>

      Attachments

        1. AMQNET-135-741308.diff
          2 kB
          Allan Schrum

        Activity

          People

            jgomes Jim Gomes
            breaker Tomasz Wiczling
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: