1 Reply Latest reply on Jul 25, 2007 3:07 AM by Dimitris Andreadis

    MBean init and schedule

    j h Newbie

      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