/** * Publish an error message for the supplied throwable and context. * The {@link #errorMessageStrategy} is used to build a {@link ErrorMessage} * to publish. * @param throwable the throwable. May be null. * @param context the context for {@link ErrorMessage} properties. */ public void publish(Throwable throwable, AttributeAccessor context) { populateChannel(); Throwable payload = determinePayload(throwable, context); ErrorMessage errorMessage = this.errorMessageStrategy.buildErrorMessage(payload, context); if (this.logger.isDebugEnabled() && payload instanceof MessagingException) { MessagingException exception = (MessagingException) errorMessage.getPayload(); this.logger.debug("Sending ErrorMessage: failedMessage: " + exception.getFailedMessage(), exception); } this.messagingTemplate.send(errorMessage); }
/** * Publish an error message for the supplied throwable and context. * The {@link #errorMessageStrategy} is used to build a {@link ErrorMessage} * to publish. * @param throwable the throwable. May be null. * @param context the context for {@link ErrorMessage} properties. */ public void publish(Throwable throwable, AttributeAccessor context) { populateChannel(); Throwable payload = determinePayload(throwable, context); ErrorMessage errorMessage = this.errorMessageStrategy.buildErrorMessage(payload, context); if (this.logger.isDebugEnabled() && payload instanceof MessagingException) { MessagingException exception = (MessagingException) errorMessage.getPayload(); this.logger.debug("Sending ErrorMessage: failedMessage: " + exception.getFailedMessage(), exception); } this.messagingTemplate.send(errorMessage); }