You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by ravican09 <ra...@gmail.com> on 2016/10/21 15:20:53 UTC

NMS Active MQ: Error handling and debuggin in C#

Error handling does not work the way we would expect for some reason tester
given  invalid urlQueue for the connectionFactory , the program simply
hangs,

below is the sample code 


 try
                    {
                        var connectionUri = new Uri(ConnectionUri);
                        IConnectionFactory connectionFactory = new
NMSConnectionFactory(connectionUri);
                        Log.Debug(string.Format("NMS Event: Creating
Connection: {0}", connectionUri));
                        _connection =
connectionFactory.CreateConnection(_userName, _password);
                       Log.Debug(string.Format("NMS Event: Created
Connection: {0}", connectionUri));
                        if (_connection.IsStarted == false)
                        {
                            Log.Debug(string.Format("NMS Event: Starting
Connection: {0}", connectionUri));
                            _connection.Start();
                            Log.Debug(string.Format("NMS Event: Started
Connection: {0}", connectionUri));
                        }
                        _connection.ExceptionListener += ExceptionListener;
                        _connection.ConnectionInterruptedListener +=
ConnectionInterruptedListener;
                        _connection.ConnectionResumedListener +=
ConnectionResumedListener;
                    }
                    catch (Exception ex)
                    {
                        Log.Error("Error creating NMS Connection.", ex);
                        throw;
                    }



--
View this message in context: http://activemq.2283324.n4.nabble.com/NMS-Active-MQ-Error-handling-and-debuggin-in-C-tp4668567p4718243.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: NMS Active MQ: Error handling and debuggin in C#

Posted by Timothy Bish <ta...@gmail.com>.
Have a look at the failover documentation, the answer lies there: 
http://activemq.apache.org/nms/activemq-uri-configuration.html

On 10/21/2016 12:14 PM, ravican09 wrote:
> True
>
> activemq:failover:(tcp://brtuxjmsap02d.xxxx.net:61616)?transport.reconnectDelay=15000&transport.initialReconnectDelay=1000&connection.dispatchAsync=true
>
> is there any way i can get exception ,so that we can avoid program hang
>
> Thank you
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/NMS-Active-MQ-Error-handling-and-debuggin-in-C-tp4668567p4718245.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>


-- 
Tim Bish
twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: NMS Active MQ: Error handling and debuggin in C#

Posted by ravican09 <ra...@gmail.com>.
True 

activemq:failover:(tcp://brtuxjmsap02d.xxxx.net:61616)?transport.reconnectDelay=15000&transport.initialReconnectDelay=1000&connection.dispatchAsync=true

is there any way i can get exception ,so that we can avoid program hang

Thank you 



--
View this message in context: http://activemq.2283324.n4.nabble.com/NMS-Active-MQ-Error-handling-and-debuggin-in-C-tp4668567p4718245.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: NMS Active MQ: Error handling and debuggin in C#

Posted by Timothy Bish <ta...@gmail.com>.
You'd need to share the URI for anyone to know for sure, my guess would 
be you gave it a failover URI and it's sitting there trying to connect 
to a host that doesn't exist which is expected behavior

On 10/21/2016 11:20 AM, ravican09 wrote:
> Error handling does not work the way we would expect for some reason tester
> given  invalid urlQueue for the connectionFactory , the program simply
> hangs,
>
> below is the sample code
>
>
>   try
>                      {
>                          var connectionUri = new Uri(ConnectionUri);
>                          IConnectionFactory connectionFactory = new
> NMSConnectionFactory(connectionUri);
>                          Log.Debug(string.Format("NMS Event: Creating
> Connection: {0}", connectionUri));
>                          _connection =
> connectionFactory.CreateConnection(_userName, _password);
>                         Log.Debug(string.Format("NMS Event: Created
> Connection: {0}", connectionUri));
>                          if (_connection.IsStarted == false)
>                          {
>                              Log.Debug(string.Format("NMS Event: Starting
> Connection: {0}", connectionUri));
>                              _connection.Start();
>                              Log.Debug(string.Format("NMS Event: Started
> Connection: {0}", connectionUri));
>                          }
>                          _connection.ExceptionListener += ExceptionListener;
>                          _connection.ConnectionInterruptedListener +=
> ConnectionInterruptedListener;
>                          _connection.ConnectionResumedListener +=
> ConnectionResumedListener;
>                      }
>                      catch (Exception ex)
>                      {
>                          Log.Error("Error creating NMS Connection.", ex);
>                          throw;
>                      }
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/NMS-Active-MQ-Error-handling-and-debuggin-in-C-tp4668567p4718243.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>


-- 
Tim Bish
twitter: @tabish121
blog: http://timbish.blogspot.com/