List of usage examples for org.springframework.amqp AmqpRejectAndDontRequeueException AmqpRejectAndDontRequeueException
public AmqpRejectAndDontRequeueException(Throwable cause)
From source file:org.flockdata.engine.dao.TagWrangler.java
private String resolveKeyPrefix(String keyPrefix, String suffix) { if (keyPrefix != null && keyPrefix.contains(":")) { // Label:Value to set the prefix // DAT-479 indirect lookup String[] values = StringUtils.split(keyPrefix, ":"); if (values.length == 2) { Tag indirect = findTag(suffix, values[0], null, values[1], false); if (indirect == null) { // ToDo: Exception or literal? logger.debug("Indirect syntax was found but resolved to no tag"); throw new AmqpRejectAndDontRequeueException("Unable to resolve the indirect tag" + keyPrefix); } else { return indirect.getCode(); }//from ww w . j a v a 2 s.co m } } return keyPrefix; }
From source file:org.springframework.amqp.rabbit.retry.MissingMessageIdAdvice.java
public Object invoke(MethodInvocation invocation) throws Throwable { String id = null;// w ww .ja v a 2 s. c o m boolean redelivered = false; try { Message message = (Message) invocation.getArguments()[1]; MessageProperties messageProperties = message.getMessageProperties(); if (messageProperties.getMessageId() == null) { id = UUID.randomUUID().toString(); messageProperties.setMessageId(id); } redelivered = messageProperties.isRedelivered(); return invocation.proceed(); } catch (Throwable t) { if (id != null && redelivered) { if (logger.isDebugEnabled()) { logger.debug("Canceling delivery of retried message that has no ID"); } throw new ListenerExecutionFailedException("Cannot retry message without an ID", new AmqpRejectAndDontRequeueException(t)); } else { throw t; } } finally { if (id != null) { retryContextCache.remove(id); } } }
From source file:org.springframework.amqp.rabbit.retry.RejectAndDontRequeueRecoverer.java
@Override public void recover(Message message, Throwable cause) { if (this.logger.isWarnEnabled()) { this.logger.warn("Retries exhausted for message " + message, cause); }/*from w w w. j ava2s . c om*/ throw new ListenerExecutionFailedException("Retry Policy Exhausted", new AmqpRejectAndDontRequeueException(cause), message); }