/** * Apply a Message recoverer - default is to log and discard after retry is exhausted. * @param recoverer The recoverer. * @return this. */ public B recoverer(MessageRecoverer recoverer) { this.messageRecoverer = recoverer; return _this(); }
/** * Apply a Message recoverer - default is to log and discard after retry is exhausted. * @param recoverer The recoverer. * @return this. */ public B recoverer(MessageRecoverer recoverer) { this.messageRecoverer = recoverer; return _this(); }
/** * Apply the retry operations - once this is set, other properties can no longer be set; can't * be set if other properties have been applied. * @param retryOperations The retry operations. * @return this. */ public B retryOperations(RetryOperations retryOperations) { Assert.isTrue(!this.templateAltered, "Cannot set retryOperations when the default has been modified"); this.retryOperations = retryOperations; return _this(); }
/** * Apply the retry operations - once this is set, other properties can no longer be set; can't * be set if other properties have been applied. * @param retryOperations The retry operations. * @return this. */ public B retryOperations(RetryOperations retryOperations) { Assert.isTrue(!this.templateAltered, "Cannot set retryOperations when the default has been modified"); this.retryOperations = retryOperations; return _this(); }
/** * Apply the back off policy. Cannot be used if a custom retry operations, or back off policy has been applied. * @param policy The policy. * @return this. */ public B backOffPolicy(BackOffPolicy policy) { Assert.isNull(this.retryOperations, "cannot set the back off policy when a custom retryOperations has been set"); Assert.isTrue(!this.backOffOptionsSet, "cannot set the back off policy when the back off policy options have been set"); this.retryTemplate.setBackOffPolicy(policy); this.templateAltered = true; this.backOffPolicySet = true; return _this(); }
/** * Apply the back off policy. Cannot be used if a custom retry operations, or back off policy has been applied. * @param policy The policy. * @return this. */ public B backOffPolicy(BackOffPolicy policy) { Assert.isNull(this.retryOperations, "cannot set the back off policy when a custom retryOperations has been set"); Assert.isTrue(!this.backOffOptionsSet, "cannot set the back off policy when the back off policy options have been set"); this.retryTemplate.setBackOffPolicy(policy); this.templateAltered = true; this.backOffPolicySet = true; return _this(); }
/** * Apply the retry policy - cannot be used if a custom retry template has been provided, or the max attempts or * back off options or policy have been applied. * @param policy The policy. * @return this. */ public B retryPolicy(RetryPolicy policy) { Assert.isNull(this.retryOperations, "cannot set the retry policy when a custom retryOperations has been set"); Assert.isTrue(!this.templateAltered, "cannot set the retry policy if max attempts or back off policy or options changed"); this.retryTemplate.setRetryPolicy(policy); this.retryPolicySet = true; this.templateAltered = true; return _this(); }
/** * Apply the retry policy - cannot be used if a custom retry template has been provided, or the max attempts or * back off options or policy have been applied. * @param policy The policy. * @return this. */ public B retryPolicy(RetryPolicy policy) { Assert.isNull(this.retryOperations, "cannot set the retry policy when a custom retryOperations has been set"); Assert.isTrue(!this.templateAltered, "cannot set the retry policy if max attempts or back off policy or options changed"); this.retryTemplate.setRetryPolicy(policy); this.retryPolicySet = true; this.templateAltered = true; return _this(); }
/** * Apply the max attempts - a SimpleRetryPolicy will be used. Cannot be used if a custom retry operations * or retry policy has been set. * @param maxAttempts the max attempts. * @return this. */ public B maxAttempts(int maxAttempts) { Assert.isNull(this.retryOperations, "cannot alter the retry policy when a custom retryOperations has been set"); Assert.isTrue(!this.retryPolicySet, "cannot alter the retry policy when a custom retryPolicy has been set"); this.simpleRetryPolicy.setMaxAttempts(maxAttempts); this.retryTemplate.setRetryPolicy(this.simpleRetryPolicy); this.templateAltered = true; return _this(); }
/** * Apply the max attempts - a SimpleRetryPolicy will be used. Cannot be used if a custom retry operations * or retry policy has been set. * @param maxAttempts the max attempts. * @return this. */ public B maxAttempts(int maxAttempts) { Assert.isNull(this.retryOperations, "cannot alter the retry policy when a custom retryOperations has been set"); Assert.isTrue(!this.retryPolicySet, "cannot alter the retry policy when a custom retryPolicy has been set"); this.simpleRetryPolicy.setMaxAttempts(maxAttempts); this.retryTemplate.setRetryPolicy(this.simpleRetryPolicy); this.templateAltered = true; return _this(); }
/** * Apply the backoff options. Cannot be used if a custom retry operations, or back off policy has been set. * @param initialInterval The initial interval. * @param multiplier The multiplier. * @param maxInterval The max interval. * @return this. */ public B backOffOptions(long initialInterval, double multiplier, long maxInterval) { Assert.isNull(this.retryOperations, "cannot set the back off policy when a custom retryOperations has been set"); Assert.isTrue(!this.backOffPolicySet, "cannot set the back off options when a back off policy has been set"); ExponentialBackOffPolicy policy = new ExponentialBackOffPolicy(); policy.setInitialInterval(initialInterval); policy.setMultiplier(multiplier); policy.setMaxInterval(maxInterval); this.retryTemplate.setBackOffPolicy(policy); this.backOffOptionsSet = true; this.templateAltered = true; return _this(); }
/** * Apply the backoff options. Cannot be used if a custom retry operations, or back off policy has been set. * @param initialInterval The initial interval. * @param multiplier The multiplier. * @param maxInterval The max interval. * @return this. */ public B backOffOptions(long initialInterval, double multiplier, long maxInterval) { Assert.isNull(this.retryOperations, "cannot set the back off policy when a custom retryOperations has been set"); Assert.isTrue(!this.backOffPolicySet, "cannot set the back off options when a back off policy has been set"); ExponentialBackOffPolicy policy = new ExponentialBackOffPolicy(); policy.setInitialInterval(initialInterval); policy.setMultiplier(multiplier); policy.setMaxInterval(maxInterval); this.retryTemplate.setBackOffPolicy(policy); this.backOffOptionsSet = true; this.templateAltered = true; return _this(); }