org.apache.camel.processor
Class RedeliveryPolicy

java.lang.Object
  extended by org.apache.camel.processor.RedeliveryPolicy
All Implemented Interfaces:
Serializable, Cloneable

public class RedeliveryPolicy
extends Object
implements Cloneable, Serializable

The policy used to decide how many times to redeliver and the time between the redeliveries before being sent to a Dead Letter Channel

The default values is:

Version:
$Revision: 37863 $
See Also:
Serialized Form

Field Summary
protected  double backOffMultiplier
           
protected  double collisionAvoidanceFactor
           
protected  long initialRedeliveryDelay
           
protected  int maximumRedeliveries
           
protected static Random randomNumberGenerator
           
protected  boolean useCollisionAvoidance
           
protected  boolean useExponentialBackOff
           
 
Constructor Summary
RedeliveryPolicy()
           
 
Method Summary
 RedeliveryPolicy backOffMultiplier(double multiplier)
          Enables exponential backoff and sets the multiplier used to increase the delay between redeliveries
 RedeliveryPolicy collisionAvoidancePercent(double collisionAvoidancePercent)
          Enables collision avoidence and sets the percentage used
 RedeliveryPolicy copy()
           
 double getBackOffMultiplier()
           
 double getCollisionAvoidanceFactor()
           
 short getCollisionAvoidancePercent()
           
 long getInitialRedeliveryDelay()
           
 int getMaximumRedeliveries()
           
protected static Random getRandomNumberGenerator()
           
 long getRedeliveryDelay(long previousDelay)
           
 RedeliveryPolicy initialRedeliveryDelay(long initialRedeliveryDelay)
          Sets the initial redelivery delay in milliseconds on the first redelivery
 boolean isUseCollisionAvoidance()
           
 boolean isUseExponentialBackOff()
           
 RedeliveryPolicy maximumRedeliveries(int maximumRedeliveries)
          Sets the maximum number of times a message exchange will be redelivered
 void setBackOffMultiplier(double backOffMultiplier)
          Sets the multiplier used to increase the delay between redeliveries if setUseExponentialBackOff(boolean) is enabled
 void setCollisionAvoidanceFactor(double collisionAvoidanceFactor)
          Sets the factor used for collision avoidence if enabled via setUseCollisionAvoidance(boolean)
 void setCollisionAvoidancePercent(double collisionAvoidancePercent)
          Sets the percentage used for collision avoidence if enabled via setUseCollisionAvoidance(boolean)
 void setInitialRedeliveryDelay(long initialRedeliveryDelay)
          Sets the initial redelivery delay in milliseconds on the first redelivery
 void setMaximumRedeliveries(int maximumRedeliveries)
          Sets the maximum number of times a message exchange will be redelivered.
 void setUseCollisionAvoidance(boolean useCollisionAvoidance)
          Enables/disables collision avoidence which adds some randomization to the backoff timings to reduce contention probability
 void setUseExponentialBackOff(boolean useExponentialBackOff)
          Enables/disables exponential backof using the getBackOffMultiplier() to increase the time between retries
 boolean shouldRedeliver(int redeliveryCounter)
          Returns true if the policy decides that the message exchange should be redelivered
 String toString()
           
 RedeliveryPolicy useCollisionAvoidance()
          Enables collision avoidence which adds some randomization to the backoff timings to reduce contention probability
 RedeliveryPolicy useExponentialBackOff()
          Enables exponential backof using the getBackOffMultiplier() to increase the time between retries
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

randomNumberGenerator

protected static transient Random randomNumberGenerator

maximumRedeliveries

protected int maximumRedeliveries

initialRedeliveryDelay

protected long initialRedeliveryDelay

backOffMultiplier

protected double backOffMultiplier

useExponentialBackOff

protected boolean useExponentialBackOff

collisionAvoidanceFactor

protected double collisionAvoidanceFactor

useCollisionAvoidance

protected boolean useCollisionAvoidance
Constructor Detail

RedeliveryPolicy

public RedeliveryPolicy()
Method Detail

toString

public String toString()
Overrides:
toString in class Object

copy

public RedeliveryPolicy copy()

shouldRedeliver

public boolean shouldRedeliver(int redeliveryCounter)
Returns true if the policy decides that the message exchange should be redelivered


maximumRedeliveries

public RedeliveryPolicy maximumRedeliveries(int maximumRedeliveries)
Sets the maximum number of times a message exchange will be redelivered


initialRedeliveryDelay

public RedeliveryPolicy initialRedeliveryDelay(long initialRedeliveryDelay)
Sets the initial redelivery delay in milliseconds on the first redelivery


useCollisionAvoidance

public RedeliveryPolicy useCollisionAvoidance()
Enables collision avoidence which adds some randomization to the backoff timings to reduce contention probability


useExponentialBackOff

public RedeliveryPolicy useExponentialBackOff()
Enables exponential backof using the getBackOffMultiplier() to increase the time between retries


backOffMultiplier

public RedeliveryPolicy backOffMultiplier(double multiplier)
Enables exponential backoff and sets the multiplier used to increase the delay between redeliveries


collisionAvoidancePercent

public RedeliveryPolicy collisionAvoidancePercent(double collisionAvoidancePercent)
Enables collision avoidence and sets the percentage used


getBackOffMultiplier

public double getBackOffMultiplier()

setBackOffMultiplier

public void setBackOffMultiplier(double backOffMultiplier)
Sets the multiplier used to increase the delay between redeliveries if setUseExponentialBackOff(boolean) is enabled


getCollisionAvoidancePercent

public short getCollisionAvoidancePercent()

setCollisionAvoidancePercent

public void setCollisionAvoidancePercent(double collisionAvoidancePercent)
Sets the percentage used for collision avoidence if enabled via setUseCollisionAvoidance(boolean)


getCollisionAvoidanceFactor

public double getCollisionAvoidanceFactor()

setCollisionAvoidanceFactor

public void setCollisionAvoidanceFactor(double collisionAvoidanceFactor)
Sets the factor used for collision avoidence if enabled via setUseCollisionAvoidance(boolean)


getInitialRedeliveryDelay

public long getInitialRedeliveryDelay()

setInitialRedeliveryDelay

public void setInitialRedeliveryDelay(long initialRedeliveryDelay)
Sets the initial redelivery delay in milliseconds on the first redelivery


getMaximumRedeliveries

public int getMaximumRedeliveries()

setMaximumRedeliveries

public void setMaximumRedeliveries(int maximumRedeliveries)
Sets the maximum number of times a message exchange will be redelivered. Setting a negative value will retry forever.


getRedeliveryDelay

public long getRedeliveryDelay(long previousDelay)

isUseCollisionAvoidance

public boolean isUseCollisionAvoidance()

setUseCollisionAvoidance

public void setUseCollisionAvoidance(boolean useCollisionAvoidance)
Enables/disables collision avoidence which adds some randomization to the backoff timings to reduce contention probability


isUseExponentialBackOff

public boolean isUseExponentialBackOff()

setUseExponentialBackOff

public void setUseExponentialBackOff(boolean useExponentialBackOff)
Enables/disables exponential backof using the getBackOffMultiplier() to increase the time between retries


getRandomNumberGenerator

protected static Random getRandomNumberGenerator()


Copyright © 2008 IONA Open Source Community. All Rights Reserved.