Package org.springframework.amqp.rabbit.retry

Examples of org.springframework.amqp.rabbit.retry.MessageRecoverer


    if (stateful) {
      factory = new StatefulRetryOperationsInterceptorFactoryBean();
    } else {
      factory = new StatelessRetryOperationsInterceptorFactoryBean();
    }
    factory.setMessageRecoverer(new MessageRecoverer() {
      @Override
      public void recover(Message message, Throwable cause) {
        logger.info("Recovered: [" + SerializationUtils.deserialize(message.getBody()).toString()+"], message: " +message);
        latch.countDown();
      }
View Full Code Here


          return newMessageIdentifier.isNew(message);
        }
      }
    });

    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 {
          messageRecoverer.recover(message, cause);
        }
        // This is actually a normal outcome. It means the recovery was successful, but we don't want to consume
        // any more messages until the acks and commits are sent for this (problematic) message...
        throw new ImmediateAcknowledgeAmqpException("Recovered message forces ack (if ack mode requires it): "
            + message, cause);
View Full Code Here

    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 {
          messageRecoverer.recover(message, cause);
        }
        return null;
      }
    });
View Full Code Here

TOP

Related Classes of org.springframework.amqp.rabbit.retry.MessageRecoverer

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.