Subscribe rss
Blog categories
All | Backendless features
Feature 109: Custom business logic – timers (overview)
April 27, 2015 by markpiller
Spread the love

There are two types of custom business logic scrips supported by Backendless – API event handlers and timers. In this post I will review the latter. A timer is a server-side program deployed to the Backendless server infrastructure which is scheduled to run on a pre-defined schedule. Once the code is deployed, Backendless makes sure the code runs exactly accordingly to the schedule. We handle all the runtime aspects – finding an available host to run the code, loading all the dependencies, making sure the code runs securely within an isolated sandbox. Backendless supports a variety of schedules. A timer may be scheduled to run only once, or once a day at the specified time, every day, a few times a week, a month, a year, etc. Additionally, a timer may have an expiration date/time.

Timer code must be in Java, and we’re working on adding support for other server-side languages. The code may use Backendless SDK for Java/Android to interact with the application’s data. The example below is a basic timer. All configuration properties of a timer must be specified in the @BackendlessTimer annotation. The annotation accepts a JSON object (as a string) with all the timer properties. For example, the timer below is configured to start on the date/time defined in the startDate property of the annotation. The frequency property sets the timer schedule. The code below requests the timer to run every two days.

There is a lot more to just creating Timer code. There is a process for testing the timer and  deploying to the Backendless servers. These features will be reviewed in the upcoming posts.

Share this post
Tweet about this on TwitterShare on FacebookGoogle+