Timer Service


Info

Short description The Timer Service enables the execution of methods at a determined point of time whereby the configuration, as execution in the range of seconds is also possible, allows a significant higher differentiation then services like CRON. In contrast to most available solutions, developers don't have to configure scripts that'll be executed, instead they configure methods of message driven, stateless or singleton session beans. Beside scheduled execution it is possible to create timers programmatically what allows you to invoke methods once or scheduled at a dedicated point of time in future.
Availability from 1.0.0
Type Main Module
Dependencies Appserver.io Runtime, Appserver.io, Persistence Container
PSR https://github.com/appserver-io-psr/epb


Functions

Features
  • Programmatically created timers with execution on a dedicated point of time in future using microseconds
  • Scheduled execution of methods of message driven, stateless, or singleton session beans using seconds
  • Asynchronous execution
  • Simple configuration through annotations on the respective method
  • Use annotations to configure scheduled timers

Use Case

The need to schedule tasks is given in nearly every application, especially for applications in an enterprise environment. In most cases, PHP applications use system services like CRON to schedule their tasks. Several e-commerce applications provides script like cron.sh, that has to be scheduled by CRON every minute and itself will again execute configured, long running tasks, like updating the table indexes, by a complicated, internal functionality. As PHP is single-threaded by default, this leads to several problems, e. g. long running tasks blocks others, also very important tasks, that can be executed only if the previous task has been finished. The Message Queue is a simple solution to solve such problems, because every task will be executed asynchronously in a separate thread that will never block other tasks.