activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanjeev (JIRA)" <jira+amq...@apache.org>
Subject [jira] Commented: (AMQNET-131) .NET Client is not receiving messages
Date Fri, 05 Dec 2008 10:52:05 GMT

    [ https://issues.apache.org/activemq/browse/AMQNET-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47879#action_47879
] 

Sanjeev commented on AMQNET-131:
--------------------------------

Jim,

I tried as suggested. But this is also not working. It is not picking messages at all. It
is not throwing any exception also.  The code is modified as below

Private Sub OpenConnections()
    Try
      ListenLocationQueueMessaage()
      ListenMeterQueueMessaage()
      ListenWOQueueMessaage()

      'Starting Connections
      locConnection.Start()
      mtrConnection.Start()
      woConnection.Start()
             
      LogMessage("Connections Started.")
    Catch ex As Exception
      LogMessage(ex.Message)
    End Try
End Sub


When I tried to run on the following environment it is working fine

DEV Environment
1. .NET Producer on Windows XP/2003 server
2. ActiveMQ on JBoss Web server on Windows 2003 Server (ActiveMQ 4.1/5.1,  JBOSS 4.2.2) 
3. .NET Consumer on Windows XP/2003 server

I ran it for one day continuously, consumer is getting messages even after one day without
any restart. No issues found in this environment.

But, when I tried to run the same code on the following environment

ST Environment
1. Java Producer using Mule, is placing Messages into Queue.
2. ActiveMQ on JBoss web server, running on Linux (ActiveMQ 4.1/5.1,  JBOSS 4.2.2) 
3. .NET Consumer running as Windows Service on Windows 2003 server

It is listening to messages only at the time of starting service. It is not getting messages
after some time. But there are messages in the queue. After sometime, we had to restart the
service. Sometimes we had to restart 2 to 3 times. The issue is observed sporadically in ST
environment.


Scenario Tested

1. Start the .NET Consumer.
2. Java producer places messages into queue.
3. Consumer picking the messages well.
4. Wait for one hour and place messages into queue again.
5. Consumer is not getting messages this time.

I tried different coding options for this

1. Using SimpleMessageContainer.
2. Using Consumer.ReceiveNoWait().
3. Using Exception Handler with IConnection.
4. Opening and closing connections at regular intervals of time.

All of these seem to be working well on Dev Environment, but none of them are working on ST
environment. Kindly suggest. 


Issue Summary: 

.NET client is not able to receive messages from ActiveMQ after some time. We need to restart
the service when it gets stuck. Sometimes even restarting the service does not work. No errors
get logged.

The issue is observed sporadically in:
•       Consumer on Windows 2003 server and Producer and ActiveMQ on Linux
 
Strangely, the issue has NOT been observed in the following environments. These envs imply
producer on Windows 
•        .NET Listener running on Windows 2003 Server and JBoss ActiveMQ on Windows 2003
Server
•        .NET Listener running on Windows XP and JBoss ActiveMQ on Windows 2003 Server 
 
 
Options Tried (without success):
•         Option 1: .NET client is deployed as windows service. Events are registered to
the queues to notify the client whenever a message arrives into 
queue.
•         Option 2: .NET client is deployed as windows service. Polling the queues explicitly
at regular intervals of time to pull the messages from queue using Consumer.ReceiveNoWait()

Thanks,
Sanjeev.




> .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
>         ''' <summary>
>         ''' Starts all queues
>         ''' </summary>
>         ''' <remarks></remarks>
>         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
>         ''' <summary>
>         ''' Listener for Location queue
>         ''' </summary>
>         ''' <remarks></remarks>
>         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
>         ''' <summary>
>         ''' Listener for Meter queue
>         ''' </summary>
>         ''' <remarks></remarks>
>         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
>         ''' <summary>
>         ''' Listener for WorkOrder queue
>         ''' </summary>
>         ''' <remarks></remarks>
>         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
>         ''' <summary>
>         ''' Listener for Infra queue
>         ''' </summary>
>         ''' <remarks></remarks>
>         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.


Mime
View raw message