PDA

View Full Version : NMS Window Service


jamesc323
02-20-2008, 08:49 PM
Having some problems with NMS and the Listener in a Windows Service.
The listener does not register, ie

listener.AfterPropertiesSet() has no effect.

Has anyone else had the same issue?
JMS Queue registers the consumer, the messages are consumed, but as there are no handler register as AfterProperties() does not work, the messages are not handled.

Regards
James

Mark Pollack
02-21-2008, 08:15 PM
Hi James,

I have not heard of the same issue. Is the application working for you outside of it being windows service? By listener I assume you mean SimpleMessageListenerContainer right? Can your provide a little more description of how you are creating the application context in the windows service?

Cheers,
Mark

jamesc323
02-23-2008, 05:03 AM
I have a Windows Service which starts up a timer event.
The timer event instantiates the Singleton class which registers the listener and its handler.

If I place breakpoints on AfterPropertiesSet() method, it never breaks at the point, which means the handler is never registered. Weird thing is, the consumer count is registering the windows application, and the queue is cleared.

public bool B1JmsServiceRealTime()
{
bool bResult = true;
string URI = localAppSettings.ActiveMQConnectionString;
string dest = localAppSettings.DSRSBORealQueue;

int index = 0;


if (messageContainerInstance == 0)
{
try
{
//TransactionPollingJob job = new TransactionPollingJob();
//ThreadStart ts = new ThreadStart(job.PollDataTable);
//Thread thread = new Thread(ts);
//thread.Start();

connectionFactory = new ConnectionFactory(URI);


listenerContainer.ConnectionFactory = connectionFactory;
listenerContainer.DestinationName = dest;
listenerContainer.MessageListener = messListener;
listenerContainer.AfterPropertiesSet();
messageContainerInstance = 1;



}
catch (Exception ex)
{
SBOErrorMessage sboError = new SBOErrorMessage();
B1JMSSend(sboError);
bResult = false;
}
}
return bResult;

}

jamesc323
02-23-2008, 05:05 AM
On yes, another thing, if I place the same code in a Windows console, it works.

Mark Pollack
02-25-2008, 03:47 PM
Hi,

Can you provide a minimal solution that reproduces the error and specify what version of ActiveMQ and Spring.NET you are using?

Since you are calling the APIs directly and it never reaches the call to AfterPropertiesSet, it might be a ActiveMQ/NMS issue. Did you set a breakpoint in the entry to the method B1JmsServiceRealTime?


Cheers,
Mark