[jboss-user] [Management, JMX/JBoss] - MBean init and schedule

loseyourself do-not-reply at jboss.com
Tue Jul 24 21:18:07 EDT 2007


Greetings all,

I create an Mbean and deploy it to JBoss 3.2.5, the overview of the MBean is:
public class TopicMailListener extends ServiceMBeanSupport 
  | 	implements MessageListener, TopicMailListenerMBean {
  |                 String url;
  | 	String name;
  | 
  | 	public TopicMailListener(String url, String name) {
  | 		super();
  | 
  | 		this.url = url;
  | 		this.name = name;
  | 		LOGGER.info("Topc mail listner initiaated: url: " + url + "; name: " + name);
  | 	}
  | 	
  | 	public void start() throws Exception {
  | 		try {
  | 			super.start();
  | 			LOGGER.info(">>>>>>>>>>> Topic mail listner start now...");
  | 			this.initializeListener();
  | 		} catch (Exception e) {
  | 			LOGGER.info("Error creating listener: " + e);
  | 			e.printStackTrace();
  | 		}
  | 	}
  | 	
  | 	protected void startService() throws Exception{
  | 		try {
  | 			super.startService();
  | 			LOGGER.info(">>>>>>>>>>> Topic mail listner start service now...");
  | 			this.initializeListener();
  | 		} catch (Exception e) {
  | 			LOGGER.info("Error creating listener: " + e);
  | 			e.printStackTrace();
  | 		}
  | 	}
  | 
  | }
  | 

the jboss-service.xml is as following:

  | <?xml version="1.0" encoding="UTF-8"?>
  | <server>
  |   <mbean code="au.gov.nsw.community.mail.TopicMailListener" name="au.gov.nsw.community.mail:service=TopicMailListener">
  |     <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
  |     <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
  |     <depends>jboss:service=ScheduleManager</depends>
  |     <depends>jboss:service=SchedulableMBeanExample</depends>
  |     <attribute name="StartAtStartup">true</attribute>
  |     <attribute name="DateFormat"></attribute>
  |     <attribute name="StartDate">NOW</attribute>
  |     <attribute name="Period">10000</attribute>
  |     <attribute name="Repetitions">-1</attribute>
  |     <attribute name="SecurityConf">
  |       <security>
  |         <role name="guest" read="true" write="true"/>
  |         <role name="publisher" read="true" write="true" create="false"/>
  |         <role name="durpublisher" read="true" write="true" create="true"/>
  |       </security>
  |     </attribute>
  |     <constructor>
  |     	<arg type="java.lang.String" value="10.65.240.244:1099"/>
  | 		<arg type="java.lang.String" value="topic/testTopic"/>    	
  |     </constructor>
  |   </mbean>
  | </server>
  | 

but it doesn't invoke the construct or start, startService method while this class is deployed as a service in JMX. Any ideas?

And based on this MBean, how can I configure it as a schedule service, say it will be started immediately and every 1 minute will be invoked.

I do appreciate for any help.

cheers,
hj

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067248#4067248

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067248



More information about the jboss-user mailing list