![]() The Scheduler APIįrom above you can see that we give you two variables to play with in the script. You should see the scheduler started with the hello world message printed on log output. Now you can fire off the scheduler: $ bin/scheduler.sh config/scheduler.properties ![]() In your config/oovy file, you may try this: ("Hello World!") ScriptingService.initScript = config/oovy ScriptingService.scriptEngineName = Groovy You will start by create a config/scheduler.properties file like this: .class = You may initialize the scheduler along with a script file and let it execute and prepare jobs or anything you would need before the scheduler is started. You are free to choose other engine if you want to explore it further. (Note that Groovy is only an optional dependency for TimeMachine scheduler itself, and we have properly set our maven pom.xml as such.)Īll the demo code in this tour will use Groovy. So we decided to make TimeMachine distribution zip file pre-packaged the Groovy jars for user convenient. We have found the Groovy scripting engine to be very productive, and its syntax are very similar to Java language itself, but yet very concise and expressive. You may add any other script engine jars in to the "lib" directory and specify the scriptEngineName parameter to change it. So TimeMachine has default to use "JavaScript" as scripting engine. Starting JVM 6 or higher, it already comes with JavaScript engine implementation, and there is no external dependency with this. I will be covering some of these features in this tour. The TimeMachine Scheduler embraced the easy and flexibility of scripting. For example Groovy, Ruby or Jython are just few popular open source ones. There are many solid JVM based scripting engines available out there today. Scripting language is a great way to extend an application, and with Java 6 or higher it has ScriptingEngine API baked right in. For the most current and accurate instructions, please visit the ReferenceManual from the project site. These articles will introduce you to the scheduler, how to load jobs and schedules, and explore some of its advanced features. This is part 2 of 7 in a series of articles that will give you a tour of the TimeMachine Scheduler project.
0 Comments
Leave a Reply. |