Example usage for org.springframework.messaging MessagingException MessagingException

List of usage examples for org.springframework.messaging MessagingException MessagingException

Introduction

In this page you can find the example usage for org.springframework.messaging MessagingException MessagingException.

Prototype

public MessagingException(Message<?> message, @Nullable String description, @Nullable Throwable cause) 

Source Link

Usage

From source file:org.springframework.integration.channel.FixedSubscriberChannel.java

@Override
public boolean send(Message<?> message, long timeout) {
    try {/* w w  w . j  a va2s  .c  om*/
        this.handler.handleMessage(message);
        return true;
    } catch (RuntimeException e) {
        if (e instanceof MessagingException && ((MessagingException) e).getFailedMessage() == null) {
            throw new MessagingException(message, "Failed to handle Message", e);
        } else {
            throw e;
        }
    }
}

From source file:org.springframework.integration.support.ErrorMessagePublisher.java

/**
 * Build a {@code Throwable payload} for future {@link ErrorMessage}.
 * @param throwable the error to determine an {@link ErrorMessage} payload. Can be null.
 * @param context the context for error.
 * @return the throwable for the {@link ErrorMessage} payload
 * @see ErrorMessageUtils//from w  w  w.ja v a  2 s  .  co  m
 */
protected Throwable determinePayload(Throwable throwable, AttributeAccessor context) {
    Throwable lastThrowable = throwable;
    if (lastThrowable == null) {
        lastThrowable = payloadWhenNull(context);
    } else if (!(lastThrowable instanceof MessagingException)) {
        lastThrowable = new MessagingException(
                (Message<?>) context.getAttribute(ErrorMessageUtils.FAILED_MESSAGE_CONTEXT_KEY),
                lastThrowable.getMessage(), lastThrowable);
    }
    return lastThrowable;
}