4 Replies Latest reply: Dec 7, 2012 12:46 PM by karthik chopperla RSS

    Invoking the scheduler's doScheduledTask method from the jsp

    000201
      Hi Folks,

      Could you please throw some ideas on my issue,

      I would like to invoke the scheduler's doScheduledTask method from the jsp.
      approach is like...

      I have JSP and a form. Form has a one text field and i will give some value and clicks on the submit button, it should invoke the scheduler method.

      or

      if you know any other approach to invoke the scheduler's doScheduledTask method from the jsp is invitable.



      Thanks much in advance
        • 1. Re: Invoking the scheduler's doScheduledTask method from the jsp
          Gopinath Ramasamy
          Hi,

          1. Create the form in the jsp and a form handler to process this form, say InvokeSchedulerFormHandler.
          2. Create a variable to refer to the scheduler.

          MyScheduler myScheduler;

          // create getter and setter for this.

          3.. Create a handle method, handleInvokeScheduler(). Do any validations if required.

          4. After the validations, call getMyScheduler().doScheduledTask();
          5. In the jsp, map the submit button to this handle method.
          <dsp:input type="submit" bean="InvokeSchedulerFormHandler.invokeScheduler" value="Submit"/>

          6. Create the .properties file to the form handler and to your scheduler.

          MyScheduler.properties
          $class=com.package.MyScheduler
          $scope=global

          InvokeSchedulerFormHandler.properties
          $class=com.package.InvokeSchedulerFormHandler
          $scope=request
          myScheduler=/com/package/MyScheduler

          (Am wondering about this requirement :) . If you can specify the reason, it will be helpful).

          Hope this helps.

          Keep posting the questions / updates.

          Thanks,
          Gopinath Ramasamy
          • 2. Re: Invoking the scheduler's doScheduledTask method from the jsp
            000201
            Thank you Gopi for the response.


            does we have any approach to invoke the scheduler from JSP directly without any intermediatery like formhandler?

            Thank you

            Edited by: 000201 on Dec 7, 2012 1:53 AM
            • 3. Re: Invoking the scheduler's doScheduledTask method from the jsp
              Gopinath Ramasamy
              Hi,

              To the extent of my knowledge, a scheduler, by definition is meant to run automatically as defined by the schedule property. So there is no direct way of running it thro a jsp.

              If you want to test the scheduler by changing/setting a property, my suggestion would be to create a new property in the scheduler, set it thro dyn/admin , invoke doStopService follwed by doStartService afer specifying the schedule property to a convenient value (ex: every 5 minutes).

              Thanks,
              Gopinath Ramasamy
              • 4. Re: Invoking the scheduler's doScheduledTask method from the jsp
                karthik chopperla
                Write a droplet which invokes scheduler's doScheduledTask() method. You should have logic in a manager class. So you dont need to invoke a scheduler, you can rather invoke manager class method from droplet via js

                (Or)

                You can write a curl script to invoke through dyn/admin.

                -karthik