Results 1 to 2 of 2

Thread: Messages listener instability.

  1. #1
    Join Date
    Dec 2010
    Posts
    2

    Default Messages listener instability.

    Dear Community!

    If windows service (which contains listener) doesn't have access rights to queue, Spring.NET listener crushes application after some time (Windows even prepares crush report).

    Service Code is simple:

    public partial class DispatcherServiceHost : ServiceBase
    {

    #region Private fields

    private TransactionalMessageListenerContainer listener;

    #endregion

    public DispatcherServiceHost()
    {
    InitializeComponent();
    }

    protected override void OnStart(string[] args)
    {
    var applicationContext = ContextRegistry.GetContext();
    ServiceLocator.SetLocatorProvider
    (
    () =>
    new SpringServiceLocatorAdapter(applicationContext)
    );

    listener =
    ServiceLocator.Current.
    GetInstance<TransactionalMessageListenerContainer> ("transactionalMessageListenerContainer");

    listener.Start();
    }

    protected override void OnStop()
    {
    if (listener.Running)
    {
    listener.Stop();
    }
    }

    Configuration:

    <object id="IntegrationQueue" type="Spring.Messaging.Support.MessageQueueFactory Object, Spring.Messaging">
    <property name="Path" value=".\Private$\X.Integration.IVR.Queue"/>
    <property name="MessageReadPropertyFilterSetAll" value="true"/>
    </object>

    <object id="IntegrationDeadQueue" type="Spring.Messaging.Support.MessageQueueFactory Object, Spring.Messaging">
    <property name="Path" value=".\Private$\X.Integration.IVR.DeadQueue"/>
    <property name="MessageReadPropertyFilterSetAll" value="true"/>
    </object>

    <!-- MSMQ Transaction Manager -->
    <object id="messageQueueTransactionManager" type="Spring.Messaging.Core.MessageQueueTransactio nManager, Spring.Messaging"/>

    <!-- Message Listener Container that uses MSMQ transactional for receives -->
    <object id="transactionalMessageListenerContainer" type="Spring.Messaging.Listener.TransactionalMessa geListenerContainer, Spring.Messaging">
    <!-- to increase the number of threads use the MaxConcurrentListeners property -->
    <property name="AutoStartup" value="false"/>
    <property name="MaxConcurrentListeners" value="10"/>
    <property name="MessageQueueObjectName" value="IntegrationQueue"/>
    <property name="PlatformTransactionManager" ref="messageQueueTransactionManager"/>
    <property name="MessageListener" ref="messageListenerAdapter"/>
    <property name="MessageTransactionExceptionHandler" ref="sendToQueueExceptionHandler"/>
    </object>

    <!-- Delegate to plain .NET object for message handling -->
    <object id="messageListenerAdapter" type="Spring.Messaging.Listener.MessageListenerAda pter, Spring.Messaging">
    <property name="HandlerObject" ref="DispatcherHandler"/>
    <property name="DefaultHandlerMethod" value="Handle"/>
    <property name="MessageConverterObjectName" value="xmlMessageConverter"/>
    </object>

    <object id="sendToQueueExceptionHandler" type="Spring.Messaging.Listener.SendToQueueExcepti onHandler, Spring.Messaging">
    <property name="MessageQueueObjectName" value="IntegrationDeadQueue"/>
    </object>

    Does anyone encountered something similiar?

  2. #2
    Join Date
    Aug 2012
    Posts
    3

    Default

    If you dont have access to read/write on Queue, you need to configure one of two sides:

    1) Configure your Service to use an account with privileges to Read/Write on ".\Private$\X.Integration.IVR.Queue"
    2) Configure your Queue to accept Read/Write from your service account.

    Anyway you will have problems with the method Stop of your TransactionalMessageListenerContainer if there running. In many cases I had to use brute force to kill the process, programmatically.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •