Announcement Announcement Module
Collapse
No announcement yet.
Programatically access MessageHandlers exposed via JMX Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Programatically access MessageHandlers exposed via JMX

    I am trying to access the MessageHandler endpoint to start and stop the service via JMX. I have the below configuration in my context file. I am able to access the start/stop methods via JConsole.

    I am also able to access the endpoint using MBeanServerConnectionFactoryBean from a spring based client.

    Now i want to access the endpoint using MBeanProxyFactoryBean so that i can directly invoke the methods as if the bean was local. This doesnt seem to work.

    Can you please see my configuation below and suggest whats wrong or what more needs to be done?

    Server xml

    Code:
    <jmx:mbean-export default-domain="com.irebalpoc.integration" server="mbeanServer"/>
    
    <int-jms:message-driven-channel-adapter id="jmsIn" 
    	    connection-factory="connectionFactory" concurrent-consumers="3" max-concurrent-consumers="5" 
    		destination-name="emsQueue" acknowledge="transacted" channel="jmsInChannel"  
    		extract-payload="false" />
    
     <integration:service-activator id="serviceAct" input-channel="jmsInChannel" output-channel="fileNamesChannel" 
        	ref="handler" method="process" />
    Client xml

    Code:
     <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 is the interface in which i have defined start() , stop() and isRunning() methods so that i can access it from any class.

    When i try to test it i get invocation exception.
    Any suggestion will be much appreciated
    Last edited by shashikanthb; Jun 25th, 2012, 06:50 AM.

  • #2
    First, stopping the handler is not the right thing to do - all that will do is unsubscribe from the channel and the messages will get errors "Dispatcher has no subscribers". You need to stop() the message-driven-channel-adapter.

    Second, you need to supply the full MBean object name, e.g. "com.irebalpoc.integration:type=ManagedEndpoint,na me=jmsin,bean=endpoint". You can find this in the MBean metadata (e.g. in VisualVM).

    Comment


    • #3
      Garry, thanks a lot. I did the changes as per your suggestion. it worked.

      Comment

      Working...
      X