简体   繁体   中英

What is the best way to handle JMS Exceptions

I have a for loop that keeps putting messages onto the JMS Queue but its quite possible that in future the for loop may execute way faster than the Queue can handle requests and might reach the max-pool limit.

I am catching the JMSException but the thing is that I don't have any fallback logic in place to resume the job. I mean I can store the state of last element passed on to the queue but I have no clue as how to start putting the messages back to the queue after the Exception has been encountered.. How can I start putting messages back to the Queue and make sure that same Exception wont be thrown.

You should set up your JMS queue with a pool of listeners that's adequate for your peak load. This can be arranged with your app server.

It should also allow a "dead letter queue" where messages that are poisonous in the way you describe will be routed.

It would be good to configure some kind of altering to let you know requests are spilling onto the floor.

I don't understand the fascination with queues anymore. I think a web service with a producer/consumer dequeue and a pool of executors to process requests is a better choice that a queue. That's 1990s IBM technology.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM