May 19th, 2011, 11:27 PM
Spawning a Data Access from a JMS Listener
Am new to Spring and have a question -
I am having a Spring Asynchronous Listener, configured in my XML file which is listening to the messages coming on the MQ correctly.For each incoming and listened method, I need to insert that into a database and for which I have the Spring Hibernate integration done too. My Spring HiberNate ORM works fine when tested alone with the DAOs that I have written but not when spawned and called from the listener.
My question is -
1. Is it a good Idea to inject my DAO Instance into the Listener Class - The user defined Delegate one that has the listener method - see this below - ref="mailListener - This mailListener bean I meant to inject my DAO into -
<bean id="mailListenerAdapter" class="org.springframework.jms.listener.adapter.Me ssageListenerAdapter"> <property name="delegate" ref="mailListener" /> <property name="defaultListenerMethod" value="displayMail" />
2. How do I transaction manage it, it these programs are running from a simple Java standalone programs and not deployed on any of the App Servers.
Thanks for the help in advance and please let me know if I need elaborate my question.