Hi all,

Given our message processing model, we do not enqueue message content in
memory, and only keep message metadata. So, at the final point of a message
delivery, we retrieve the message content accordingly and send.

However, if a user purges a queue while subscribers are receiving from it,
all message content of that queue is deleted from the database, even though
some messages might be at the final delivery stage. So when the message
content of such a message is looked up, it will throw an NPE /
NoSuchElementException.

We cannot infer if the exception is due to a purge scenario or something
else, because MessageContent can also be lost due to other reasons (e.g. :
a message being acknowledged while it's second delivery attempt is on the
way)

I could think of following ways to handle this :

1. Catch the exception and add a general trace log explaining all possible
reasons -> clear the message from in memory collections since we can safely
say that its already been acked / purged.

2. Figure out and skip deleting the (message content + metadata) of
enqueued / redelivered messages in-memory, and assume they will be deleted
later from normal delivery flow. This means that all the in-memory,
undelivered messages will still be delivered even after the queue is
purged. (User can interpret this as an issue)

Better suggestions ? The ideal solution would be to exactly remove all
undelivered messages (in-store and in-memory) at the moment of purge. But
this is difficult since the in-memory message buffer maybe delegated very
fast into delivery jobs.

As at now, I feel that "option 1" would be the most feasible solution.

WDYT ?


-- 
Cheers,

Hasitha Amal De Silva
 Software Engineer
Mobile : 0772037426
Blog    : http://devnutshell.tumblr.com/
WSO2 Inc.: http://wso2.com ( lean.enterprise.middleware. )
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to