private String getRequiredQueue() throws IllegalStateException { String name = this.defaultReceiveQueue; if (name == null) { throw new AmqpIllegalStateException("No 'queue' specified. Check configuration of RabbitTemplate."); } return name; }
private MessageConverter getRequiredMessageConverter() throws IllegalStateException { MessageConverter converter = getMessageConverter(); if (converter == null) { throw new AmqpIllegalStateException( "No 'messageConverter' specified. Check configuration of RabbitTemplate."); } return converter; }
return new AmqpConnectException((ShutdownSignalException) ex); return new AmqpConnectException((ConnectException) ex); return new AmqpAuthenticationException(ex); return new AmqpUnsupportedEncodingException(ex); return new AmqpIOException((IOException) ex); return new AmqpTimeoutException(ex); return new org.springframework.amqp.rabbit.support.ConsumerCancelledException(ex); return new UncategorizedAmqpException(ex);
@RabbitListener(id = "defaultDLX", bindings = @QueueBinding( value = @Queue(value = "amqp656", autoDelete = "true", arguments = { @Argument(name = "x-dead-letter-exchange", value = ""), @Argument(name = "x-dead-letter-routing-key", value = "amqp656dlq"), @Argument(name = "test-empty", value = ""), @Argument(name = "test-null", value = "") }), exchange = @Exchange(value = "amq.topic", type = "topic"), key = "foo")) public String handleWithDeadLetterDefaultExchange(String foo) { throw new AmqpRejectAndDontRequeueException("dlq"); }
@Override public void recover(Message message, Throwable cause) { if (this.logger.isWarnEnabled()) { this.logger.warn("Retries exhausted for message " + message, cause); } throw new ListenerExecutionFailedException("Retry Policy Exhausted", new AmqpRejectAndDontRequeueException(cause), message); }
/** * Construct a template using the supplied uri. * @param uri the uri - must include user info, e.g. * "http://guest:guest@localhost:15672/api/". * @since 2.0 */ public RabbitManagementTemplate(String uri) { try { this.rabbitClient = new Client(uri); } catch (Exception e) { throw new AmqpException(e); } }
protected static final void logAndThrowMessageError(final Message message, final String error) { LOGGER.warn("Warning! \"{}\" reported by message: {}", error, message); throw new AmqpRejectAndDontRequeueException(error); }
@Test public void testDontRequeueDefaultNot() throws Exception { testRequeueOrNotDefaultNo(new AmqpRejectAndDontRequeueException("fail"), false); }
public static void rollbackIfNecessary(Channel channel) { Assert.notNull(channel, "Channel must not be null"); try { channel.txRollback(); } catch (IOException ex) { throw new AmqpIOException(ex); } }
@Override public void recover(Message message, Throwable cause) { if (this.logger.isWarnEnabled()) { this.logger.warn("Retries exhausted for message " + message + "; requeuing...", cause); } throw new ImmediateRequeueAmqpException(cause); }
@Override public String getMessage() { return super.getMessage() + this.failedQueues.toString(); }
return new AmqpConnectException((ShutdownSignalException) ex); return new AmqpConnectException((ConnectException) ex); return new AmqpAuthenticationException(ex); return new AmqpUnsupportedEncodingException(ex); return new AmqpIOException((IOException) ex); return new AmqpTimeoutException(ex); return new org.springframework.amqp.rabbit.support.ConsumerCancelledException(ex); return new UncategorizedAmqpException(ex);
private MessageConverter getRequiredMessageConverter() throws IllegalStateException { MessageConverter converter = getMessageConverter(); if (converter == null) { throw new AmqpIllegalStateException( "No 'messageConverter' specified. Check configuration of RabbitTemplate."); } return converter; }
/** * Construct a template using the supplied uri. * @param uri the uri - must include user info, e.g. * "http://guest:guest@localhost:15672/api/". * @since 2.0 */ public RabbitManagementTemplate(String uri) { try { this.rabbitClient = new Client(uri); } catch (Exception e) { throw new AmqpException(e); } }
private String getRequiredQueue() throws IllegalStateException { String name = this.defaultReceiveQueue; if (name == null) { throw new AmqpIllegalStateException("No 'queue' specified. Check configuration of RabbitTemplate."); } return name; }
public static void rollbackIfNecessary(Channel channel) { Assert.notNull(channel, "Channel must not be null"); try { channel.txRollback(); } catch (IOException ex) { throw new AmqpIOException(ex); } }
@Override public void recover(Message message, Throwable cause) { if (this.logger.isWarnEnabled()) { this.logger.warn("Retries exhausted for message " + message + "; requeuing...", cause); } throw new ImmediateRequeueAmqpException(cause); }
@Override public String getMessage() { return super.getMessage() + this.failedQueues.toString(); }
/** * Construct a template using the supplied uri. * @param uri the uri. * @param username the user. * @param password the password. */ public RabbitManagementTemplate(String uri, String username, String password) { try { this.rabbitClient = new Client(uri, username, password); } catch (Exception e) { throw new AmqpException(e); } }
/** * Construct a template using the supplied uri. * @param uri the uri. * @param username the user. * @param password the password. */ public RabbitManagementTemplate(String uri, String username, String password) { try { this.rabbitClient = new Client(uri, username, password); } catch (Exception e) { throw new AmqpException(e); } }