Siva raj

Configuring rule server at runtime

Discussion created by Siva raj on Feb 22, 2011
Latest reply on Mar 1, 2011 by Jostein Ulseth

Hi,

 

I have written a ServiceMonitorFactory and SericeAgentMonitorFactory in which i am trying to print the events. if i configure the respective tags inside the server configuation file and when i start the server and run the client, i am able to view the events processed (With System outs dumped on the screen from the monitors).

 

example configuration:

  <ServiceAgentMonitorFactory>
           <JavaName>qdtest.ServiceAgentMonitor</JavaName>
  </ServiceAgentMonitorFactory>
  
  <ServiceMonitorFactory>
   <JavaName>qdtest.ServiceMonitor</JavaName>
  </ServiceMonitorFactory>

 

The problem what i am facing is when i am trying to set these above mentioned factories during runtime, i am not able to view any of the events.(none of the System outs are printing on the screen). But the rule is getting executed.

Sample code :

 

public void runExample(String[] args)
{
  try {
   // Create the server
   String serverConfig = (args.length > 0) ? args[0] : _SERVER_CONFIG;
   Server server = (Server)Server.createServer(serverConfig);


   NdServerConfig config = server.getServerConfig();
   NdServiceConfig[] serviceConfig = config.getServiceConfig();

   NdServiceAgentMonitorFactory[] sss = new NdServiceAgentMonitorFactory[1];
   sss[0] = new NdServiceAgentMonitorFactory("qdtest.ServiceAgentMonitor");
   serviceConfig[i].setServiceAgentMonitorFactory(sss);

   NdServiceMonitorFactory[] sm = new NdServiceMonitorFactory[1];
   sm[0] = new NdServiceMonitorFactory("qdtest.ServiceMonitor");
   serviceConfig[i].setServiceMonitorFactory(sm);

     }

   
   // Create the client of the server
   Client client = new Client(server);

   // Run the client
   client.run();


   // Shut down the Server server instance
   server.shutdown();

  }
  catch (Exception ex) {
   ex.printStackTrace();
   NdWrappedExceptionSupport.printStackTrace(ex);
   System.exit(-1);
  }

 }

 

 

Kindly help me in this regards. Also suggest me if this is the correct way of doing it and how to achive it.

 

Regards

Sivaraj

Outcomes