Please some help understanding the following:
I am using CachingConnectionFactory
in my app and first used it during my jms tests to test my jms config like guaranteed delivery, rollback/commit, etc..
I am using Spring's JmsTemplate
for sending and DefaultMessageListenerContainer
during delivery.
I noticed that this is hard/impossible when using several test methods run sequential Example: in test method A I throw exceptions in the Message listener (consumer side) such that retries occur. Then test B is run and in method A I do a different test, but when I start this test I still get retry messages from test A, which I clearly not want. I purge the Queue through jmx between tests, but still receive these retries :(... I searched and debugged... I don't exactly understand why these retries keep comming up, even when I am sure that the purge occur correctly. Maybe it was already cached somewhere in the session... I don't know. Anybody any idea?
I found out that I needed to use the
SingleConnectionFactory
during testing. With this connection factory the retries disappear, but I don't really understand why. Why? I understand that it uses only one connection (from the Spring ref), and noticed that it somehow removes the consumer after every send action, but I don't really understand what happen with these retries :(... Any idea? (It's hard to debug because of the multi threading behavior and difficult to find good information about it on the web) Also usingCachingConnectionFactory
with only one session cache size of 1 didn't solve the retry issue.
Thanks