[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: Need Notification when message is dropped due to max siz
timfox
do-not-reply at jboss.com
Sun Sep 30 12:08:17 EDT 2007
"jhowell at redhat.com" wrote : I have a customer that wants to put in an aspect to do some sort of notification if a message is dropped due to the maxsize. I can see in ChannelSupport that the max size is handed via
|
| protected Delivery handleInternal(DeliveryObserver sender, MessageReference ref,
| | Transaction tx, boolean persist)
| | {
| | if (ref == null)
| | {
| | return null;
| | }
| |
| | if (trace) { log.trace(this + " handles " + ref + (tx == null ? " non-transactionally" : " in transaction: " + tx)); }
| | if (maxSize != -1 && getMessageCount() >= maxSize)
| | {
| | //Have reached maximum size - will drop message
| | log.warn(this + " has reached maximum size, " + ref + " will be dropped");
| | return null;
| | }
| |
| and the Delivery gets returned as null. I don't see anything that I can use to figure out if the message is dropped.
|
| I do see later on that if the delivery is null that we generate a JMSException in ServerConnectionEndpoint this....
|
| if (del == null)
| | {
| | throw new JMSException("Failed to route " + ref + " to " + dest.getName());
| | }
| |
|
| My guess is that theres nothing that they can do except catch the exception. Because we throw a JMSException and not a MessagingJMSException, it makes it hard. Should we throw a typed exception, like MaxMessageReachedException or throw a MessagingJMSException with a specific error code in it. I notice that there are several cases that can return a null delivery. I would recommend that we throw a specific exception in ChannelSupport? That way we could write an aspect that would catch the specific exception. Don't know what the impact would be, but I'm guessing that there is a reason that we return null for the delivery in ChannelSupport.
One thing the user could do is catch the JMSException in his interceptor, then enquire on the queue how many messages are in it.
If number of messages in queue == maxSize, then you know queue is full.
For JBM 2.0 we can think about adding more fine grained return values / exceptions. If you like, you could add a feature request for that.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090035#4090035
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090035
More information about the jboss-dev-forums
mailing list