3 Replies Latest reply on Apr 13, 2010 11:19 AM by Nikos Massios

    Custom admin console for esb parameters

    Nikos Massios Novice

      Hello,

       

      We have implemented a custom administration console for our esb. This is essentially a web application that allows an administrator to change the configuration parameters of the custom esb extensions that are related to our esb.

       

      However there are a few parameters that are not related to our custom implementation that we would also like the administrator to change from the admin console.

       

      One example is the cron schedule. We are using a schedule provider in our esb. The definition in jboss-esb.xml looks like this

       

      <schedule-provider name="scheduler1">

       

           <cron-schedule cronExpression="0 09 10 * * ? *"  scheduleid="cron-trigger1" />

       

      </schedule-provider>

       

      The cron expression is stored in the jboss-esb.xml. How can one change the cron schedule when the schedule is stored in the xml?

       

      Our parameters are stored in a db so these kinds of modifications were possible.

       

      Has anyone tried moving the cronExpressions in the db? Is there a better way of doing this?

       

      Nikos

        • 1. Re: Custom admin console for esb parameters
          Tom Cunningham Master

          I believe there's a feature request for that already :

           

          https://jira.jboss.org/jira/browse/JBESB-1429

           

          Please add a vote for it.

          1 of 1 people found this helpful
          • 2. Re: Custom admin console for esb parameters
            Nikos Massios Novice

            I voted for the jira-issue and I am watching it.

             

            It would be nice if any changes made using the mbean are not lost every time the server is restarted.

             

            If the cron expression is initialised using jboss-esb.xml every time the server is started then any changes will be lost unless the mbean also changes the xml. Right?

             

            Nikos

            • 3. Re: Custom admin console for esb parameters
              Nikos Massios Novice

               

              This is some information we discovered today. The scheduler

              <schedule-provider name="scheduler1">    

                          <cron-schedule cronExpression="0 50 11 * * ? *"                                                                   

                                      scheduleid="cron-trigger1" />      

              </schedule-provider>

              In the jboss-esb.xml is named “scheduler1”

               

              However the quartz scheduler job is not named after the schedule provider but gets its name instead using this method

              org.jboss.soa.esb.schedule.SchedulerJob

              private static String getJobName(){

                final long id ;

                synchronized(SchedulerJob.class) {

                  id = ++jobCounter ;

                }

                return JOB_NAME + id ;

              }

               

               

              We have managed to discover all the jobs in our ESB (!!!OUR_ESB_NAME!!!.esb) and to change the quartz cron trigger for the one quartz cron trigger job. The code here is just test code. Our problem is mainly that we cannot connect the jboss-esb.xml job with the cron trigger job. For the time being it will work because we have just one cron trigger but this is not safe. Also we still have the problem that every time the esb will restart the old cron schedule will be used.

              public String listAllJobs() {

                          try {

                                      SchedulerFactory sf = new StdSchedulerFactory();

                                      Scheduler scheduler = sf.getScheduler("ESBScheduler:!!!OUR_ESB_NAME!!!.esb");

               

                                      System.out.println("scheduler " + scheduler.getSchedulerName());

                                      String[] jobGroups;

                                      String[] jobsInGroup;

                                      jobGroups = scheduler.getJobGroupNames();

                                    

                                      for (int i = 0; i < jobGroups.length; i++) {

                                                  String currentGroup = jobGroups[i];

                                                  System.out.println("Group: " + currentGroup

                                                                          + " contains the following jobs");

                                                  jobsInGroup = scheduler.getJobNames(currentGroup);

                                                              for (int j = 0; j < jobsInGroup.length; j++) {

                                                              String currentJob = jobsInGroup[j];

                                                              System.out.println("- " + currentJob);

                                                              Trigger[] jobTriggers;

                                                              jobTriggers = scheduler.getTriggersOfJob(currentJob, currentGroup);

                                                            

                                                              for(int k=0; k< jobTriggers.length; k++){

                                                                          Trigger currentTrigger = jobTriggers[k];

                                                                          if( currentTrigger instanceof CronTrigger){

                                                                                      System.out.println("--  Triggers " + currentTrigger.getFullJobName());

                                                                                      System.out.println("--  Triggers " + currentTrigger);

                                                                                      CronTrigger trigger = (CronTrigger) currentTrigger;

                                                                                      trigger.setCronExpression("0 50 12 * * ? *");

                                                                          scheduler.rescheduleJob(currentJob,currentGroup, trigger);

                                                                          }

                                                                        

                                                              }

                                                  }

                                      }

                          } catch (Exception e) {

                                      e.printStackTrace();

                          }

               

                          return null;

              }

               

              I think that some serious consideration has to take place about whether it would be better to hold the cron-schedule for jobs and the directories for ftp-provider or fs-provider outside the jboss-esb.xml as jboss-esb.xml is a “static” resource but the information in it is of a more dynamic nature.