About Timers

Top  Previous  Next

A timer in the Backendless custom business logic system is a block of code with some execution schedule. A timer itself does not need to perform any scheduling work, Backendless automatically calculates the time for the next execution step of the timer, allocates computing resources and runs the code. Consider the following sample timer class:

package com.backendless.ordermanagement.timers;

import com.backendless.servercode.annotation.BackendlessTimer;
import com.backendless.servercode.extension.TimerExtender;

@BackendlessTimer("{'startDate':1398186600000,'expire':1398878100000,'frequency':{'schedule':'daily','repeat':{'every':1}},'timername':'cool'}")
public class CoolTimer extends TimerExtender
{
  @Override
  public void execute( String appVersionId ) throws Exception
  {
    // add your custom logic here
  }
}

A timer must follow the following guidelines:

A timer implementation must be a public class which extends com.backendless.servercode.extension.TimerExtender.
A timer must have the @BackendlessTimer annotation which defines timer's schedule and the name.
A timer must override the execute method from the TimerExtender class. Any custom business logic must be in the method.

 


Please let us know how we can improve the documentation by leaving a comment. All technical questions should be posted to the Backendless Support forum. We do not respond to the technical questions on the documentation pages.: