activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shine <activ...@club.webhop.org>
Subject Re: C# - NMS.ActiveMQ (Trunk) - Windows-Service with admin-user account
Date Tue, 22 Nov 2011 20:14:46 GMT
Hi jgomes,

yes .. everything works fine after the "reconnect" and it takes never
more than one reconnect.


best regards
Marc

am Montag, 21. November 2011 um 20:49 schrieben Sie:



> This is interesting.  With your work-around in place, it will eventually
> connect and everything works correctly after that?

> On Mon, Nov 21, 2011 at 8:59 AM, Shine <activemq@club.webhop.org> wrote:

>> hi,
>>
>> I am using the latest version of NMS to connect to an ActiveMQ Server
>> (version 5.5).
>> If you use this snippet in a windows service runs with a local admin
>> credential, you get an EndOfStreamException at "this.connection.Start();".
>>
>> That snippet works fine in a normal windows application or if the service
>> runs with "local system".
>>
>> Snippet
>>
>>            try
>>            {
>>                Apache.NMS.IConnectionFactory connectionFactory = new
>> Apache.NMS.ActiveMQ.ConnectionFactory("ssl://xxxxxxxxx");
>>
>>                System.Diagnostics.Trace.WriteLine("Verbindung wird
>> erstellt.");
>>                this.connection =
>> connectionFactory.CreateConnection("MessageBrokerUsername",
>> "MessageBrokerPassword");
>>                this.connection.ExceptionListener += new
>> Apache.NMS.ExceptionListener(connection_ExceptionListener);
>>                // this.connection.ClientId =
>> System.Environment.TickCount.ToString();
>>
>>                System.Diagnostics.Trace.WriteLine("Verbindung wird
>> aufgebaut.");
>> // !!!! Here occures the exception !!!!
>>                this.connection.Start();
>>
>>                this.session = connection.CreateSession();
>>                System.Diagnostics.Trace.WriteLine("Queue wird erstellt.");
>>                Apache.NMS.IDestination destination = new
>> Apache.NMS.ActiveMQ.Commands.ActiveMQQueue("test");
>>
>>
>>                System.Diagnostics.Trace.WriteLine("Consumer wird
>> erstellt.");
>>                this.consumer = session.CreateConsumer(destination);
>>                this.consumer.Listener += new
>> Apache.NMS.MessageListener(consumer_Listener);
>>
>>            }
>>            catch (System.Exception ex)
>>            {
>>                System.Diagnostics.Trace.WriteLine(ex.ToString());
>>            }
>>
>> Workaround: Call "CreateConnection" and "Start" again.
>>
>> Replace: this.connection.Start();
>> To:
>>                bool connected = false;
>>                int connectionCounter = 0;
>>                while (!connected)
>>                {
>>                    try
>>                    {
>>                        connectionCounter++;
>>                        this.connection.Start();
>>                        connected = this.connection.IsStarted;
>>                    }
>>                    catch (System.Exception ex)
>>                    {
>>                        this.connection.Dispose();
>>                        System.Diagnostics.Trace.WriteLine(ex.ToString());
>>                        System.Diagnostics.Trace.WriteLine("Tries to
>> connect: " + connectionCounter.ToString());
>>                        System.Threading.Thread.Sleep(3000);
>>                        this.connection =
>> connectionFactory.CreateConnection("MessageBrokerUsername",
>> "MessageBrokerPassword");
>>                    }
>>                }
>>
>>
>>
>> Anyone knows a other solution for my problem?
>>
>> --
>> View this message in context:
>> http://activemq.2283324.n4.nabble.com/C-NMS-ActiveMQ-Trunk-Windows-Service-with-admin-user-account-tp4092212p4092212.html
>> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>>


> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://activemq.2283324.n4.nabble.com/C-NMS-ActiveMQ-Trunk-Windows-Service-with-admin-user-account-tp4092212p4092872.html

> To unsubscribe from C# - NMS.ActiveMQ (Trunk) - Windows-Service
> with admin-user account, visit
> http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4092212&code=YWN0aXZlbXFAY2x1Yi53ZWJob3Aub3JnfDQwOTIyMTJ8MTE4Nzc0MjAzMQ==


-- 
Mit freundlichen Grüßen
activemq@club.webhop.org
mailto:activemq@club.webhop.org



--
View this message in context: http://activemq.2283324.n4.nabble.com/C-NMS-ActiveMQ-Trunk-Windows-Service-with-admin-user-account-tp4092212p4097126.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message