Save This Page
Home » activemq-parent-5.3.1-source-release » org.apache » activemq » broker » region » policy » [javadoc | source]
    1   /**
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *      http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    */
   17   package org.apache.activemq.broker.region.policy;
   18   
   19   import org.apache.activemq.command.Message;
   20   
   21   /**
   22    * A strategy for choosing which destination is used for dead letter queue
   23    * messages.
   24    * 
   25    * @version $Revision: 426366 $
   26    */
   27   public abstract class AbstractDeadLetterStrategy implements DeadLetterStrategy {
   28       private boolean processNonPersistent = false;
   29       private boolean processExpired = true;
   30   
   31       public boolean isSendToDeadLetterQueue(Message message) {
   32           boolean result = false;
   33           if (message != null) {
   34               result = true;
   35               if (!message.isPersistent() && !processNonPersistent) {
   36                   result = false;
   37               }
   38               if (message.isExpired() && !processExpired) {
   39                   result = false;
   40               }
   41           }
   42           return result;
   43       }
   44   
   45       /**
   46        * @return the processExpired
   47        */
   48       public boolean isProcessExpired() {
   49           return this.processExpired;
   50       }
   51   
   52       /**
   53        * @param processExpired the processExpired to set
   54        */
   55       public void setProcessExpired(boolean processExpired) {
   56           this.processExpired = processExpired;
   57       }
   58   
   59       /**
   60        * @return the processNonPersistent
   61        */
   62       public boolean isProcessNonPersistent() {
   63           return this.processNonPersistent;
   64       }
   65   
   66       /**
   67        * @param processNonPersistent the processNonPersistent to set
   68        */
   69       public void setProcessNonPersistent(boolean processNonPersistent) {
   70           this.processNonPersistent = processNonPersistent;
   71       }
   72   
   73   }

Save This Page
Home » activemq-parent-5.3.1-source-release » org.apache » activemq » broker » region » policy » [javadoc | source]