org.springframework.integration.monitor
Class SimpleMessageHandlerMonitor
java.lang.Object
org.springframework.integration.monitor.SimpleMessageHandlerMonitor
- All Implemented Interfaces:
- MessageHandler, MessageHandlerMonitor
@ManagedResource
public class SimpleMessageHandlerMonitor
- extends Object
- implements MessageHandler, MessageHandlerMonitor
- Since:
- 2.0
- Author:
- Dave Syer
SimpleMessageHandlerMonitor
public SimpleMessageHandlerMonitor(MessageHandler handler)
setName
public void setName(String name)
getName
public String getName()
- Specified by:
getName
in interface MessageHandlerMonitor
setSource
public void setSource(String source)
getSource
public String getSource()
- Specified by:
getSource
in interface MessageHandlerMonitor
getMessageHandler
public MessageHandler getMessageHandler()
handleMessage
public void handleMessage(Message<?> message)
throws MessageRejectedException,
MessageHandlingException,
MessageDeliveryException
- Description copied from interface:
MessageHandler
- 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 failure of another message being sent
(e.g. a "reply" message), that failure will trigger a
MessageDeliveryException
.
- Specified by:
handleMessage
in interface MessageHandler
- Parameters:
message
- the message to be handled
- Throws:
MessageRejectedException
- if the handler doesn't accept the message
MessageHandlingException
- when something fails during the handling
MessageDeliveryException
- when this handler failed to deliver the
reply related to the handling of the message
getHandleCount
@ManagedMetric(metricType=COUNTER,
displayName="Handler Execution Count",
description="rate=1h")
public int getHandleCount()
- Specified by:
getHandleCount
in interface MessageHandlerMonitor
getErrorCount
@ManagedMetric(metricType=COUNTER,
displayName="Handler Error Count",
description="rate=1h")
public int getErrorCount()
- Specified by:
getErrorCount
in interface MessageHandlerMonitor
getMeanDuration
@ManagedMetric(metricType=GAUGE,
displayName="Handler Mean Duration")
public double getMeanDuration()
- Specified by:
getMeanDuration
in interface MessageHandlerMonitor
getMinDuration
@ManagedMetric(metricType=GAUGE,
displayName="Handler Min Duration")
public double getMinDuration()
- Specified by:
getMinDuration
in interface MessageHandlerMonitor
getMaxDuration
@ManagedMetric(metricType=GAUGE,
displayName="Handler Max Duration")
public double getMaxDuration()
- Specified by:
getMaxDuration
in interface MessageHandlerMonitor
getStandardDeviationDuration
@ManagedMetric(metricType=GAUGE,
displayName="Handler Standard Deviation Duration")
public double getStandardDeviationDuration()
- Specified by:
getStandardDeviationDuration
in interface MessageHandlerMonitor
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2010. All Rights Reserved.