On Fri, Jun 8, 2012 at 10:05 AM, gramanero <graman...@gmail.com> wrote: > How do you get the message to "bounce off the front of the queue"? Can you > control whether the message is on the front or back of the queue? You > brought up an interesting point at the beginning of this thread that > indicated that a message could get stuck on the front of the queue thus > preventing all other messages rom processing, so I would be interested to > know how you are essentially pulling the message of and putting it back on > the end of the queue. I thought a rollback would essentially keep the > message on the front of the queue. Its a FIFO queue, right? >
The rollback will cause the message to go back to the queue. It goes right back on the "front" of the queue (the place where you remove messages). Then, when your consumer grabs the next message off the queue, it will be the message you just rolled back onto the front of the queue. Then, you do the blacklist check and so forth. > Overall, an interesting approach. I like the idea of getting messages > temporarily out of the way until they can "play nice" again. I can see in a > connection lost scenario that all of the messages will potentially end up in > purgatory and then be put back on the original queue, hopefully when the > service is available again. Essentially a holding tank until the situation > resolves itself. I think the difficulty with any approach is with > determining why a message is not playing nice. It is bad message content or > is there some sort of system failure. Bad message content most likely means > that the message needs to be taken out of rotation permanently (probably not > to many cases where you can "fix" the message content), but a system failure > (i.e. consuming service is down) is when we would want to try and re-play > the message at a later time. > You're absolutely correct! There are certain types of errors that indicate that you've got an unrecoverable error (NullPointerException, JAXBException, etc.). Therefore, there will also be another feature which will allow subclasses to specify certain exception types that should just skip right over the purgatory queue and go straight to the DLC queue (or "hell" to extend the analogy). I plan on putting all of this logic into a superclass so that this is "baked in" and subclasses get it for free!