Package org.springframework.retry.interceptor

Examples of org.springframework.retry.interceptor.RetryOperationsInterceptor


    listenerContainer.setTxSize(properties.getTxSize(this.defaultTxSize));
    listenerContainer.setTaskExecutor(new SimpleAsyncTaskExecutor(queue.getName() + "-"));
    listenerContainer.setQueues(queue);
    int maxAttempts = properties.getMaxAttempts(this.defaultMaxAttempts);
    if (maxAttempts > 1) {
      RetryOperationsInterceptor retryInterceptor = RetryInterceptorBuilder.stateless()
          .maxAttempts(maxAttempts)
          .backOffOptions(properties.getBackOffInitialInterval(this.defaultBackOffInitialInterval),
              properties.getBackOffMultiplier(this.defaultBackOffMultiplier),
              properties.getBackOffMaxInterval(this.defaultBackOffMaxInterval))
          .recoverer(new RejectAndDontRequeueRecoverer())
View Full Code Here


  private static Log logger = LogFactory.getLog(StatelessRetryOperationsInterceptorFactoryBean.class);

  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>() {
      public Void recover(Object[] args, Throwable cause) {
        Message message = (Message) args[1];
        if (messageRecoverer == null) {
          logger.warn("Message dropped on recovery: " + message, cause);
        } else {
View Full Code Here

  @Test
  public void testWithRepublishRecovererExplicitExchangeAndRouting() throws Throwable {
    AmqpTemplate amqpTemplate = mock(AmqpTemplate.class);

    RetryOperationsInterceptor interceptor = RetryInterceptorBuilder.stateless()
        .recoverer(new RepublishMessageRecoverer(amqpTemplate, "bar", "baz"))
        .build();

    final AtomicInteger count = new AtomicInteger();
    Foo delegate = createDelegate(interceptor, count);
View Full Code Here

  @Test
  public void testWithRepublishRecovererDefaultExchangeAndRouting() throws Throwable {
    AmqpTemplate amqpTemplate = mock(AmqpTemplate.class);

    RetryOperationsInterceptor interceptor = RetryInterceptorBuilder.stateless()
        .recoverer(new RepublishMessageRecoverer(amqpTemplate))
        .build();

    final AtomicInteger count = new AtomicInteger();
    Foo delegate = createDelegate(interceptor, count);
View Full Code Here

  @Test
  public void testWithRepublishRecovererDefaultExchangeAndRoutingCustomPrefix() throws Throwable {
    AmqpTemplate amqpTemplate = mock(AmqpTemplate.class);

    RetryOperationsInterceptor interceptor = RetryInterceptorBuilder.stateless()
        .recoverer(new RepublishMessageRecoverer(amqpTemplate).errorRoutingKeyPrefix("bar."))
        .build();

    final AtomicInteger count = new AtomicInteger();
    Foo delegate = createDelegate(interceptor, count);
View Full Code Here

  @Test
  public void testWithRepublishRecovererCustomExchangeAndDefaultRoutingCustomPrefix() throws Throwable {
    AmqpTemplate amqpTemplate = mock(AmqpTemplate.class);

    RetryOperationsInterceptor interceptor = RetryInterceptorBuilder.stateless()
        .recoverer(new RepublishMessageRecoverer(amqpTemplate, "baz").errorRoutingKeyPrefix("bar."))
        .build();

    final AtomicInteger count = new AtomicInteger();
    Foo delegate = createDelegate(interceptor, count);
View Full Code Here

TOP

Related Classes of org.springframework.retry.interceptor.RetryOperationsInterceptor

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.