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

  • shashikanthb
    started a topic Programatically access MessageHandlers exposed via JMX

    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

    <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

     <bean id="mBeanServerClient" class="">
    		<property name="serviceUrl" value="service:jmx:rmi:///jndi/rmi://localhost:9004/jmxrmi" />
    	<bean id="jmxClient" class="">
    		<property name="connection" ref="mBeanServerClient" />
    	<bean id="remoteJMSMBean" class="org.springframework.jmx.access.MBeanProxyFactoryBean">
    		<property name="objectName" value="" />
    		<property name="server" ref="mBeanServerClient" />
    		<property name="proxyInterface" value="" />
    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.

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

    Leave a comment:

  • Gary Russell
    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).

    Leave a comment: