org.springframework.integration.jmx
Class OperationInvokingMessageHandler
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.jmx.OperationInvokingMessageHandler
- All Implemented Interfaces:
- BeanFactoryAware, BeanNameAware, InitializingBean, Ordered, NamedComponent, MessageHandler, MessageProducer, TrackableComponent
public class OperationInvokingMessageHandler
- extends AbstractReplyProducingMessageHandler
- implements InitializingBean
A MessageHandler
implementation for invoking JMX operations based on
the Message sent to its AbstractMessageHandler.handleMessage(Message)
method. Message headers
will be checked first when resolving the 'objectName' and 'operationName' to be
invoked on an MBean. These values would be supplied with the Message headers
defined as JmxHeaders.OBJECT_NAME
and JmxHeaders.OPERATION_NAME
,
respectively. In either case, if no header is present, the value resolution
will fallback to the defaults, if any have been configured on this instance via
setObjectName(String)
and setOperationName(String)
,
respectively.
The operation parameter(s), if any, must be available within the payload of the
Message being handled. If the target operation expects multiple parameters, they
can be provided in either a List or Map typed payload.
- Since:
- 2.0
- Author:
- Mark Fisher, Oleg Zhurakousky
Method Summary |
protected Object |
handleRequestMessage(Message<?> requestMessage)
Subclasses must implement this method to handle the request Message. |
void |
onInit()
Subclasses may implement this for initialization logic. |
void |
setObjectName(String objectName)
Specify a default ObjectName to use when no such header is
available on the Message being handled. |
void |
setOperationName(String operationName)
Specify an operation name to be invoked when no such
header is available on the Message being handled. |
void |
setServer(MBeanServer server)
Provide a reference to the MBeanServer within which the MBean
target for operation invocation has been registered. |
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getRequiredMetadataPersister, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString |
OperationInvokingMessageHandler
public OperationInvokingMessageHandler()
setServer
public void setServer(MBeanServer server)
- Provide a reference to the MBeanServer within which the MBean
target for operation invocation has been registered.
setObjectName
public void setObjectName(String objectName)
- Specify a default ObjectName to use when no such header is
available on the Message being handled.
setOperationName
public void setOperationName(String operationName)
- Specify an operation name to be invoked when no such
header is available on the Message being handled.
onInit
public final void onInit()
- Description copied from class:
IntegrationObjectSupport
- Subclasses may implement this for initialization logic.
- Overrides:
onInit
in class AbstractReplyProducingMessageHandler
handleRequestMessage
protected Object handleRequestMessage(Message<?> requestMessage)
- Description copied from class:
AbstractReplyProducingMessageHandler
- Subclasses must implement this method to handle the request Message. The return
value may be a Message, a MessageBuilder, or any plain Object. The base class
will handle the final creation of a reply Message from any of those starting
points. If the return value is null, the Message flow will end here.
- Specified by:
handleRequestMessage
in class AbstractReplyProducingMessageHandler
Copyright © 2010. All Rights Reserved.