In our application, we use a DefaultMessageListenerContainer with our Message Driven POJO. Recently, I've noticed a couple of things during testing. The first is that if a java.lang.Error is thrown from any code that is executed inside the onMessage method, an error message does not show up in our logs unless the logging level is set to "warn" or lower. I would expect that any java.lang.Error should be logged at the "error" level...
Upon further investigation, I found these lines inside AbstractMessageListenerContainer.java (we're using Spring 2.5.1), circa line 631:
// Regular case: failed while active.
// Log at error level.
logger.warn("Execution of JMS message listener failed", ex);
Is this message intended to be logged at the "warn" level? If so, why?
Second, I have noticed that if on startup, a DefaultMessageListenerContainer cannot obtain a specified resource (e.g. a JMS Server), it does not throw an exception right away. Instead, it sleeps for the configured "recovery interval" (default 5 seconds), tries to set itself up again, and THEN throws an exception (see lines 827 and following in DefaultMessageListenerContainer.java). I think it would be useful to have the container throw an immediate exception if any required resources cannot be acquired on startup...the retries seem more useful when a previously running listener loses connectivity or something. Anyway, I am wondering if this is the intended behavior for DefaultMessageListenerContainer...
Thanks in advance for your responses!