开发者

How to stop JBoss from spamming logs if an exception occurs in onMessage of a MDB?

开发者 https://www.devze.com 2023-01-21 02:46 出处:网络
I have a listener bean which calls on a session beans method in the MDBs onMessage method. If an exception occurs, such as IllegalStateException (which I throw) or NPE, then JBoss keeps logging the开发

I have a listener bean which calls on a session beans method in the MDBs onMessage method. If an exception occurs, such as IllegalStateException (which I throw) or NPE, then JBoss keeps logging the开发者_开发百科 exception, and also keeps retrying to deliver the same message, again spamming the logs, then it sends the message to DLQ, and again calls onMessage which again fails... madness.

Is there any way to stop this? Is there a configuration property for an MDB which tells, if any exceptions occurs in the onMessage (if onMessage doesnt return) retry X times, then fricking stop trying! Is there?


are you using listener ports or activation specs? I don't use JBoss, I use WebSphere, but I found that under the listener port area in WebSphere you can set the max retry count. Also perhaps there is a spot in your administration console where you could change the logging levels so it doesn't spam you? Lastly I would look for a property in your message header called retryCount (or create one if you don't have one). Then use that and check for it in your bean. If it reads it and you have failed N times, then automatically forward to the DLQ without JBoss doing it for you. Might save you some headache.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号