Examples of NeverRetryPolicy


Examples of org.springframework.retry.policy.NeverRetryPolicy

  }

  @Test
  public void testFailureAndRecovery() throws Exception {
    final RetryTemplate retryTemplate = new RetryTemplate();
    retryTemplate.setRetryPolicy(new NeverRetryPolicy());
    container.setMessageListener(new MessageListener() {
      @Override
      public void onMessage(final Message msg) {
        try {
          RetryCallback<Message, Exception> callback = new RetryCallback<Message, Exception>() {
View Full Code Here

Examples of org.springframework.retry.policy.NeverRetryPolicy

         * Do not have Spring AMQP re-try messages upon failure, leave it to Camel
         * @return An advice chain populated with a NeverRetryPolicy
         */
        public final Advice[] getAdviceChain() {
            RetryTemplate retryRule = new RetryTemplate();
            retryRule.setRetryPolicy(new NeverRetryPolicy());
           
            StatefulRetryOperationsInterceptorFactoryBean retryOperation = new StatefulRetryOperationsInterceptorFactoryBean();
            retryOperation.setRetryOperations(retryRule);
            retryOperation.setMessageKeyGeneretor(new DefaultKeyGenerator());
           
View Full Code Here

Examples of org.springframework.retry.policy.NeverRetryPolicy

         * Do not have Spring AMQP re-try messages upon failure, leave it to Camel
         * @return An advice chain populated with a NeverRetryPolicy
         */
        public final Advice[] getAdviceChain() {
            RetryTemplate retryRule = new RetryTemplate();
            retryRule.setRetryPolicy(new NeverRetryPolicy());
           
            StatefulRetryOperationsInterceptorFactoryBean retryOperation = new StatefulRetryOperationsInterceptorFactoryBean();
            retryOperation.setRetryOperations(retryRule);
            retryOperation.setMessageKeyGeneretor(new DefaultKeyGenerator());
           
View Full Code Here

Examples of org.springframework.retry.policy.NeverRetryPolicy

    assertEquals("2:1", list.get(0));
  }

  @Test
  public void testOnError() throws Throwable {
    template.setRetryPolicy(new NeverRetryPolicy());
    template.setListeners(new RetryListener[] { new RetryListenerSupport() {
      public <T, E extends Throwable> void onError(RetryContext context, RetryCallback<T, E> callback, Throwable throwable) {
        list.add("1");
      }
    }, new RetryListenerSupport() {
View Full Code Here

Examples of org.springframework.retry.policy.NeverRetryPolicy

  @Test
  public void testAlwaysTryAtLeastOnce() throws Throwable {
    MockRetryCallback callback = new MockRetryCallback();
    RetryTemplate retryTemplate = new RetryTemplate();
    retryTemplate.setRetryPolicy(new NeverRetryPolicy());
    retryTemplate.execute(callback);
    assertEquals(1, callback.attempts);
  }
View Full Code Here

Examples of org.springframework.retry.policy.NeverRetryPolicy

  }

  @Test
  public void testRethrowError() throws Throwable {
    RetryTemplate retryTemplate = new RetryTemplate();
    retryTemplate.setRetryPolicy(new NeverRetryPolicy());
    try {
      retryTemplate.execute(new RetryCallback<Object, Exception>() {
        public Object doWithRetry(RetryContext context) throws Exception {
          throw new Error("Realllly bad!");
        }
View Full Code Here

Examples of org.springframework.retry.policy.NeverRetryPolicy

  }

  @Test
  public void testFailedPolicy() throws Throwable {
    RetryTemplate retryTemplate = new RetryTemplate();
    retryTemplate.setRetryPolicy(new NeverRetryPolicy() {
      @Override
      public void registerThrowable(RetryContext context, Throwable throwable) {
        throw new RuntimeException("Planned");
      }
    });
View Full Code Here

Examples of org.springframework.retry.policy.NeverRetryPolicy

  private List<String> list = new ArrayList<String>();

  @Test
  public void testOpenSunnyDay() throws Exception {
    RetryContext context = retryTemplate.open(new NeverRetryPolicy(), new DefaultRetryState("foo"));
    assertNotNull(context);
    // we haven't called the processor yet...
    assertEquals(0, count);
  }
View Full Code Here

Examples of org.springframework.retry.policy.NeverRetryPolicy

    assertEquals(0, count);
  }

  @Test
  public void testRegisterThrowable() {
    NeverRetryPolicy retryPolicy = new NeverRetryPolicy();
    RetryState state = new DefaultRetryState("foo");
    RetryContext context = retryTemplate.open(retryPolicy, state);
    assertNotNull(context);
    retryTemplate.registerThrowable(retryPolicy, state, context, new Exception());
    assertFalse(retryPolicy.canRetry(context));
  }
View Full Code Here

Examples of org.springframework.retry.policy.NeverRetryPolicy

    assertFalse(retryPolicy.canRetry(context));
  }

  @Test
  public void testClose() throws Exception {
    NeverRetryPolicy retryPolicy = new NeverRetryPolicy();
    RetryState state = new DefaultRetryState("foo");
    RetryContext context = retryTemplate.open(retryPolicy, state);
    assertNotNull(context);
    retryTemplate.registerThrowable(retryPolicy, state, context, new Exception());
    assertFalse(retryPolicy.canRetry(context));
    retryTemplate.close(retryPolicy, context, state, true);
    // still can't retry, even if policy is closed
    // (not that this would happen in practice)...
    assertFalse(retryPolicy.canRetry(context));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.