Configuration 以编程方式访问通过JMX公开的MessageHandler

Configuration 以编程方式访问通过JMX公开的MessageHandler,configuration,spring-integration,spring-jmx,Configuration,Spring Integration,Spring Jmx,我试图通过JMX访问MessageHandler端点来启动和停止服务。我的上下文文件中有以下配置。我可以通过JConsole访问start/stop方法 我还能够从基于spring的客户端使用MBeanServerConnectionFactoryBean访问端点 现在我想使用MBeanProxyFactoryBean访问端点,这样我就可以直接调用这些方法,就像bean是本地的一样。这似乎不起作用 你能看看我下面的配置,并建议有什么问题或还有什么需要做的吗 Server.xml Clien

我试图通过JMX访问MessageHandler端点来启动和停止服务。我的上下文文件中有以下配置。我可以通过JConsole访问start/stop方法

我还能够从基于spring的客户端使用MBeanServerConnectionFactoryBean访问端点

现在我想使用MBeanProxyFactoryBean访问端点,这样我就可以直接调用这些方法,就像bean是本地的一样。这似乎不起作用

你能看看我下面的配置,并建议有什么问题或还有什么需要做的吗

Server.xml


Client.xml

<bean id="mBeanServerClient" class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean">
    <property name="serviceUrl" value="service:jmx:rmi:///jndi/rmi://localhost:9004/jmxrmi" />
</bean>

<bean id="jmxClient" class="com.abc.test.IBalJMXClient">
    <property name="connection" ref="mBeanServerClient" />
</bean>
<bean id="remoteJMSMBean" class="org.springframework.jmx.access.MBeanProxyFactoryBean">
    <property name="objectName" value="com.abc.test:name=serviceAct" />
    <property name="server" ref="mBeanServerClient" />
    <property name="proxyInterface" value="com.abc.client.intf.IBalJMSController" />
</bean>

IBalJMSController是我在其中定义start()、stop()和isRunning()方法的接口,因此我可以从任何类访问它

当我尝试测试它时,我得到调用异常。
任何建议都将不胜感激

您在春季论坛上提出了同样的问题;我在那里回答了

但我会在这里重复答案

首先,停止处理程序不是正确的做法-所做的只是取消订阅通道,消息将出现错误“Dispatcher没有订阅者”。您需要停止()消息驱动的通道适配器


其次,您需要提供完整的MBean对象名称,例如“com.irebalpoc.integration:type=ManagedEndpoint,na me=jmsin,bean=endpoint”。您可以在MBean元数据(例如在VisualVM中)中找到它。

谢谢您的回答。我之前没有收到任何回复,所以我在这里添加了它。
<bean id="mBeanServerClient" class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean">
    <property name="serviceUrl" value="service:jmx:rmi:///jndi/rmi://localhost:9004/jmxrmi" />
</bean>

<bean id="jmxClient" class="com.abc.test.IBalJMXClient">
    <property name="connection" ref="mBeanServerClient" />
</bean>
<bean id="remoteJMSMBean" class="org.springframework.jmx.access.MBeanProxyFactoryBean">
    <property name="objectName" value="com.abc.test:name=serviceAct" />
    <property name="server" ref="mBeanServerClient" />
    <property name="proxyInterface" value="com.abc.client.intf.IBalJMSController" />
</bean>