.NET Client is not receiving messages ------------------------------------- Key: AMQNET-131 URL: https://issues.apache.org/activemq/browse/AMQNET-131 Project: ActiveMQ .Net Issue Type: Bug Components: ActiveMQ Client Environment: 1. Java Producer using Mule placing Messages into Queue. 2. ActiveMQ on JBoss web server, running on Linux 3. .NET Consumer running as Windows Service on Windows 2003 server Reporter: Sanjeev Assignee: Jim Gomes Priority: Critical I am using IMessageConsumer to receive messages from the queue using NMS on .NET. The listener is dying periodically within half-hour. I could see messages in the queue. But .NET Listener is not getting any messages. The messages are arriving after I restart the service. Please find below the code I am using Imports System Imports System.Collections.Generic Imports System.Text Imports System.Configuration Imports System.Threading Imports ActiveMQ Imports Spring.Messaging.Nms Imports Spring.Messaging.Nms.Listener Imports Business.RIO.Business Imports BusinessEntities.RIO.Entities Imports Exceptions.RMSExceptions Imports Utils.RIO.Utils Imports NMS Imports System.Xml Imports System.Timers Namespace ListenerConsole Public Class InterfaceBaseHelper #Region "Private Variables" Private config As ConfigurationEntity #End Region Public Sub New() config = New ConfigurationEntity() config.ServerName = ConfigurationManager.AppSettings("ServerName") config.LocationQueueName = ConfigurationManager.AppSettings("LocationQueueName") config.CustQueueName = ConfigurationManager.AppSettings("CustomerQueueName") config.WOQueueName = ConfigurationManager.AppSettings("WOQueueName") config.MeterQueueName = ConfigurationManager.AppSettings("MeterQueueName") config.InfraQueueName = ConfigurationManager.AppSettings("InfraQueueName") config.LocationAckQueueName = ConfigurationManager.AppSettings("LocationAcknowledgementQueueName") config.MeterAckQueueName = ConfigurationManager.AppSettings("MeterAcknowledgementQueueName") config.WOAckQueueName = ConfigurationManager.AppSettings("WOAcknowledgementQueueName") config.InfraAckQueueName = ConfigurationManager.AppSettings("InfraAcknowledgementQueueName") config.CustAckQueueName = ConfigurationManager.AppSettings("CustAcknowledgementQueueName") config.ErrorQueueName = ConfigurationManager.AppSettings("ErrorQueueName") config.ServerPollingIntervalInSeconds = Convert.ToInt32(ConfigurationManager.AppSettings("ServerConnectionPollingIntervalInSeconds")) facade = New RIOFacade(config) End Sub Dim timer As System.Timers.Timer Dim facade As RIOFacade ''' ''' Starts all queues ''' ''' Public Sub ServiceStartUp() Try timer = New System.Timers.Timer() timer.Interval = config.ServerPollingIntervalInSeconds * 1000 timer.Enabled = True OpenConnections() AddHandler timer.Elapsed, (AddressOf StartConnections) timer.Start() Catch ex As Exception ExceptionManager.HandleException(ex) RIOHelper.LogException(ex) End Try End Sub Dim lookupsCached As Boolean = False Private Sub OpenConnections() Try ListenLocationQueueMessaage() ListenMeterQueueMessaage() ListeninfraQueueMessaage() ListenWOQueueMessaage() RIOHelper.LogMessage("Connections Started.") Catch ex As Exception RIOHelper.LogMessage(ex.Message) ExceptionManager.HandleException(ex) End Try End Sub Private Sub StartConnections(ByVal sender As Object, ByVal e As ElapsedEventArgs) Try timer.Stop() CloseConnections() OpenConnections() Catch ex As Exception RIOHelper.LogMessage(ex.Message) ExceptionManager.HandleException(ex) End Try timer.Start() End Sub Private Sub CloseConnections() locConnectionFactory = Nothing locConsumer.Close() locConsumer.Dispose() locSession.Close() locSession.Dispose() locConnection.Close() locConnection.Dispose() mtrConnectionFactory = Nothing mtrConsumer.Close() mtrConsumer.Dispose() mtrSession.Close() mtrSession.Dispose() mtrConnection.Close() mtrConnection.Dispose() woConnectionFactory = Nothing woConsumer.Close() woConsumer.Dispose() woSession.Close() woSession.Dispose() woConnection.Close() woConnection.Dispose() infraConnectionFactory = Nothing infraConsumer.Close() infraConsumer.Dispose() infraSession.Close() infraSession.Dispose() infraConnection.Close() infraConnection.Dispose() End Sub #Region "Listerners" Dim locConnectionFactory As ConnectionFactory Dim locConnection As IConnection Dim locSession As ISession Dim locConsumer As IMessageConsumer ''' ''' Listener for Location queue ''' ''' Private Sub ListenLocationQueueMessaage() locConnectionFactory = New ConnectionFactory(config.ServerName) locConnection = locConnectionFactory.CreateConnection() locSession = locConnection.CreateSession() locConsumer = locSession.CreateConsumer(locSession.GetQueue(config.LocationQueueName)) AddHandler locConsumer.Listener, (AddressOf HandleLocation) End Sub Private Sub HandleLocation(ByVal message As IMessage) facade.ProcessLocation(TryCast(message, ITextMessage).Text) End Sub Dim mtrConnectionFactory As ConnectionFactory Dim mtrConnection As IConnection Dim mtrSession As ISession Dim mtrConsumer As IMessageConsumer ''' ''' Listener for Meter queue ''' ''' Private Sub ListenMeterQueueMessaage() mtrConnectionFactory = New ConnectionFactory(config.ServerName) mtrConnection = mtrConnectionFactory.CreateConnection() mtrSession = mtrConnection.CreateSession() mtrConsumer = mtrSession.CreateConsumer(mtrSession.GetQueue(config.MeterQueueName)) AddHandler mtrConsumer.Listener, (AddressOf HandleMeter) End Sub Private Sub HandleMeter(ByVal message As IMessage) facade.ProcessMeter(TryCast(message, ITextMessage).Text) End Sub Dim woConnectionFactory As ConnectionFactory Dim woConnection As IConnection Dim woSession As ISession Dim woConsumer As IMessageConsumer ''' ''' Listener for WorkOrder queue ''' ''' Private Sub ListenWOQueueMessaage() woConnectionFactory = New ConnectionFactory(config.ServerName) woConnection = woConnectionFactory.CreateConnection() woSession = woConnection.CreateSession() woConsumer = woSession.CreateConsumer(woSession.GetQueue(config.WOQueueName)) AddHandler woConsumer.Listener, (AddressOf HandleWO) End Sub Private Sub HandleWO(ByVal message As IMessage) facade.ProcessWO(TryCast(message, ITextMessage).Text) End Sub Dim infraConnectionFactory As ConnectionFactory Dim infraConnection As IConnection Dim infraSession As ISession Dim infraConsumer As IMessageConsumer ''' ''' Listener for Infra queue ''' ''' Private Sub ListeninfraQueueMessaage() infraConnectionFactory = New ConnectionFactory(config.ServerName) infraConnection = infraConnectionFactory.CreateConnection() infraSession = infraConnection.CreateSession() infraConsumer = infraSession.CreateConsumer(infraSession.GetQueue(config.InfraQueueName)) AddHandler infraConsumer.Listener, (AddressOf HandleInfra) End Sub Private Sub HandleInfra(ByVal message As IMessage) facade.ProcessInfra(TryCast(message, ITextMessage).Text) End Sub #End Region End Class End Namespace -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.