org.springframework.integration.message
Interface MessageHandler

All Known Implementing Classes:
AbstractChannelNameResolvingMessageRouter, AbstractMessageAggregator, AbstractMessageBarrierHandler, AbstractMessageHandler, AbstractMessageRouter, AbstractMessageSplitter, AbstractRemotingOutboundGateway, AbstractReplyProducingMessageHandler, AbstractSingleChannelNameRouter, AbstractSingleChannelRouter, AbstractWebServiceOutboundGateway, AbstractXPathRouter, ApplicationEventPublishingMessageHandler, BridgeHandler, ByteStreamWritingMessageHandler, CharacterStreamWritingMessageHandler, DefaultMessageAggregator, DefaultMessageSplitter, DelayHandler, ErrorMessageExceptionTypeRouter, FileWritingMessageHandler, HeaderValueRouter, HttpInvokerOutboundGateway, HttpOutboundEndpoint, JmsOutboundGateway, JmsSendingMessageHandler, LoggingHandler, MailSendingMessageHandler, MarshallingWebServiceOutboundGateway, MessageFilter, MessageHandlerChain, MessageTransformingHandler, MethodInvokingAggregator, MethodInvokingMessageHandler, MethodInvokingRouter, MethodInvokingSplitter, PayloadTypeRouter, RecipientListRouter, Resequencer, RmiOutboundGateway, ServiceActivatingHandler, SimpleWebServiceOutboundGateway, XmlPayloadValidatingRouter, XPathMessageSplitter, XPathMultiChannelRouter, XPathSingleChannelRouter

public interface MessageHandler

Base interface for any component that handles Messages.

Author:
Mark Fisher, Iwein Fuld

Method Summary
 void handleMessage(Message<?> message)
          Handles the message if possible.
 

Method Detail

handleMessage

void handleMessage(Message<?> message)
                   throws MessageRejectedException,
                          MessageHandlingException,
                          MessageDeliveryException
Handles the message if possible. If the handler cannot deal with the message this will result in a MessageRejectedException e.g. in case of a Selective Consumer. When a consumer tries to handle a message, but fails to do so, a MessageHandlingException is thrown. In the last case it is recommended to treat the message as tainted and go into an error scenario.

When the handling results in a message being sent failure to send that message will result in a MessageDeliveryException.

Parameters:
message - the message to be handled
Throws:
MessageRejectedException - if the handler doesn't select these types of messages
MessageHandlingException - when something went wrong during the handling
MessageDeliveryException - when this handler failed to deliver the reply related to the handling of the message