[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Need Notification when message is dropped due to max size

jhowell@redhat.com do-not-reply at jboss.com
Thu Sep 20 09:25:08 EDT 2007


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. 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086677#4086677

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086677



More information about the jboss-dev-forums mailing list