Leverege Platform

Leverege Platform

  • Overview
  • JSDocs
  • REST API
  • Help

›Services

Platform Overview

  • Overview
  • Architecture
  • Core Concepts

Guides

  • Platform Setup
  • Building a Project
  • API UI

Services

  • API Server
  • Message Processor
  • Transponder
  • Reason
  • Scheduler
  • Messenger
  • Emailer
  • Rest Server
  • DB Curator

API

  • API
  • Interface
  • Project
  • System
  • Device
  • Blueprint
  • Collection
  • Child
  • History
  • Scenario
  • Script
  • Template
  • Timer
  • User
  • Users

Server Libraries

  • Log
  • Messages
  • Message Queue
  • Cache
  • Lock
  • Limit
  • Cluster Manager
  • Error
  • Exit

Utilities

  • Promise
  • Data Store
  • Factory
  • Path
  • Reasoner
  • Object Util
  • Array Util
  • String Util
  • Base62 Util
  • Value Cache
  • Validator
  • Lol

UI

  • API Redux
  • UI Builder
  • UI Elements
  • UI Redux
  • UI Mapbox Elements
  • UI Active Theme
  • UI Color Elements
  • UI Linear View Elements

Scheduler

Scheduler is a service that schedules timers to perform actions at a later time or in a repeating fashion. It is important to use scheduler over built in methods like setTimeout and setInterval for efficiency. Scheduler operates by saving timers to a SQL database. This database is checked at an interval specified in the config. During this check, all the timers that have reached their expiration have their functionality executed.

Timers can be created, deleted and modified in three ways. The first way is manually through the Leverege UI, under the timers section. The second way is to start a timer message in the Leverege Platform. There are several of these messages and they can be found in detail in the Messages library. The last way to interact with Timers is through the api routes exposed by scheduler.

Timers have two main attributes, the first attribute is focused on when the timers will run. Timers can be set to occur once, at a set interval or on a cron schedule. The second attribute determines what action will be taken. Actions can be to publish a message to a topic, trigger a script or query a url.

Configuration

All configuration options for scheduler have defaults set, but important information to set up a SQL connection is included that will almost always require reconfiguring.

Optional

NameDescriptionDefault
TRANSPORT_CONFIGconfig for readers and writers{ type, host, port }
NSQ_HOST_ADDRhost address for NSQ, if TRANSPORT_CONFIG is not specified'127.0.0.1'
NSQ_HOST_PORTport for NSQ, if TRANSPORT_CONFIG is not specified4150
SCHEDULER_TOPICtopic that scheduler will listen to for incoming messages'scheduler'
PORTport that scheduler will listen to9937
CORS_ORIGINacceptable CORS origin'*'
POLL_EVERYtime interval in ms that scheduler will check all timers2000
SCHEDULER_BATCH_SIZEsize of the batches that will be processed1000
SCHEDULER_LOOK_AHEADms that will be added to check if timers have passed250
SQL_MAX_CONNECTIONSmax number of SQL connections1
SQL_HOSTSQL host'localhost'
SQL_PORTSQL port3306
SQL_USERSQL user'root'
SQL_PASSWORDSQL password'root'
SQL_DBSQL database'scheduler'
SQL_TABLESQL table'scheduler'
RESCHEDULER_BATCH_SIZEsize of batches when timers are rescheduled100
SQL_CASQL ssl caundefined
SQL_CLIENT_CERTSQL ssl certundefined
SQL_CLIENT_KEYSQL ssl keyundefined
← ReasonMessenger →
  • Configuration
Leverege Platform
Docs
Overview
Connect
FacebookLinkedInTwitter
Facebook Open Source