RedeliveryPolicy xref

View Javadoc

    1   /***
    2    *
    3    * Copyright 2004 Protique Ltd
    4    *
    5    * Licensed under the Apache License, Version 2.0 (the "License");
    6    * you may not use this file except in compliance with the License.
    7    * 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   **/
    18  package org.codehaus.activemq.service;
    19
    20  /***
    21   * Represents the redelivery policy which is used when a rollback() occurs
    22   * (either JMS or XA). Various options are possible which this policy tries to capture
    23   * the main variants.
    24   * If enabled, a typical redelivery policy could be to use a back-off timeout period.
    25   *
    26   * @version $Revision: 1.1 $
    27   */
    28  public class RedeliveryPolicy {
    29      private int maximumRetryCount = 5;
    30      private boolean backOffMode = true;
    31      private long initialRedeliveryTimeout = 1000L;
    32      private double backOffIncreaseRate = 2.0;
    33
    34      /***
    35       * Returns whether or not we use a back-off timeout (increasing the timeout
    36       * by the {@link #getBackOffIncreaseRate()} each time).
    37       */
    38      public boolean isBackOffMode() {
    39          return backOffMode;
    40      }
    41
    42      public void setBackOffMode(boolean backOffMode) {
    43          this.backOffMode = backOffMode;
    44      }
    45
    46      /***
    47       * Returns the initial redelivery timeout
    48       */
    49      public long getInitialRedeliveryTimeout() {
    50          return initialRedeliveryTimeout;
    51      }
    52
    53      public void setInitialRedeliveryTimeout(long initialRedeliveryTimeout) {
    54          this.initialRedeliveryTimeout = initialRedeliveryTimeout;
    55      }
    56
    57      /***
    58       * Returns the maximum retry count on a single message before its forwarded
    59       * to a Dead Letter Queue
    60       */
    61      public int getMaximumRetryCount() {
    62          return maximumRetryCount;
    63      }
    64
    65      public void setMaximumRetryCount(int maximumRetryCount) {
    66          this.maximumRetryCount = maximumRetryCount;
    67      }
    68
    69      public double getBackOffIncreaseRate() {
    70          return backOffIncreaseRate;
    71      }
    72
    73      public void setBackOffIncreaseRate(double backOffIncreaseRate) {
    74          this.backOffIncreaseRate = backOffIncreaseRate;
    75      }
    76  }