java - Spring JMS listener receives empty messages causing CPU consumption -
i'm working on application uses couple of jms queues send/receive updates to/from external system. in order test application i'm using mockrunner , jms module. i'm facing strange behavior: when start application can see cpu skyrocketing @ 100% and, analyzing thread dumps, can see main reason related jms listeners have looks receiving empty messages causing messages like:
consumer ... did not receive message
now i'm trying understand if issue related bad interaction of app , mockrunner or configuration error.
the relevant parts of configuration are:
<bean id="destinationmanager" factory-bean="mockrunnerjmsobjectfactory" factory-method="getdestinationmanager" /> <bean id="mockjmsconnectionfactory" factory-bean="mockrunnerjmsobjectfactory" factory-method="createmockconnectionfactory" lazy-init="true"/>
and listener cause cpu spin indefinitely are:
<jms:listener-container concurrency="5" connection-factory="mockjmsconnectionfactory" destination-type="queue" message-converter="mymessageconverter" acknowledge="transacted" > <jms:listener id="mylistener" destination="myqueue" ref="myconsumer" method="consume" /> </jms:listener-container> <bean id="myconsumer"... />
update opened issue on mockrunner project, can see here.
after investigation found out problem lies in bad interaction spring defaultmessagelistenercontainer
. listener has polling-based implementation and, given mocked infrastructure fast when answering requests, cause cpu overload. patched mock runner adding ugly thread sleep in response method, maybe going fixed sooner or later.
Comments
Post a Comment