Package org.springframework.retry.support

Examples of org.springframework.retry.support.RetryTemplate


    container.setQueueNames("retry.test.queue");

    StatefulRetryOperationsInterceptorFactoryBean fb = new StatefulRetryOperationsInterceptorFactoryBean();

    // use an external template so we can share his cache
    RetryTemplate retryTemplate = new RetryTemplate();
    RetryContextCache cache = new MapRetryContextCache();
    retryTemplate.setRetryContextCache(cache);
    fb.setRetryOperations(retryTemplate);
    fb.setMessageRecoverer(new RejectAndDontRequeueRecoverer());

    // give him a reference to the retry cache so he can clean it up
    MissingMessageIdAdvice missingIdAdvice = new MissingMessageIdAdvice(cache);
View Full Code Here


  public StatefulRetryOperationsInterceptor getObject() {

    StatefulRetryOperationsInterceptor retryInterceptor = new StatefulRetryOperationsInterceptor();
    RetryOperations retryTemplate = getRetryOperations();
    if (retryTemplate == null) {
      retryTemplate = new RetryTemplate();
    }
    retryInterceptor.setRetryOperations(retryTemplate);

    retryInterceptor.setNewItemIdentifier(new NewMethodArgumentsIdentifier() {
      public boolean isNew(Object[] args) {
View Full Code Here

        throw new AuthenticationFailureException("foo");
      }
    }).when(mockConnectionFactory).newConnection((ExecutorService) null);

    RabbitTemplate template = new RabbitTemplate(new SingleConnectionFactory(mockConnectionFactory));
    template.setRetryTemplate(new RetryTemplate());
    try {
      template.convertAndSend("foo", "bar", "baz");
    }
    catch (AmqpAuthenticationException e) {
      assertThat(e.getMessage(), containsString("foo"));
View Full Code Here

        throw new AuthenticationFailureException("foo");
      }
    }).when(mockConnectionFactory).newConnection((ExecutorService) null);

    RabbitTemplate template = new RabbitTemplate(new SingleConnectionFactory(mockConnectionFactory));
    template.setRetryTemplate(new RetryTemplate());

    final AtomicBoolean recoverInvoked = new AtomicBoolean();

    template.setRecoveryCallback(new RecoveryCallback<Object>() {
View Full Code Here

  public RetryOperationsInterceptor getObject() {

    RetryOperationsInterceptor retryInterceptor = new RetryOperationsInterceptor();
    RetryOperations retryTemplate = getRetryOperations();
    if (retryTemplate == null) {
      retryTemplate = new RetryTemplate();
    }
    retryInterceptor.setRetryOperations(retryTemplate);

    final MessageRecoverer messageRecoverer = getMessageRecoverer();
    retryInterceptor.setRecoverer(new MethodInvocationRecoverer<Void>() {
View Full Code Here

    assertEquals(3, TestUtils.getPropertyValue(interceptor, "retryOperations.retryPolicy.maxAttempts"));
  }

  @Test
  public void testWithCustomRetryTemplate() {
    RetryOperations retryOperations = new RetryTemplate();
    StatefulRetryOperationsInterceptor interceptor = RetryInterceptorBuilder.stateful()
        .retryOperations(retryOperations)
        .build();
    assertEquals(3, TestUtils.getPropertyValue(interceptor, "retryOperations.retryPolicy.maxAttempts"));
    assertSame(retryOperations, TestUtils.getPropertyValue(interceptor, "retryOperations"));
View Full Code Here

TOP

Related Classes of org.springframework.retry.support.RetryTemplate

Copyright © 2018 www.massapicom. 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.