Temporize is a hosted service that provides flexible job scheduling for one-time and recurring tasks.
Temporize handles job scheduling for your application by storing and managing events that correspond to actions that your application intends to execute in the future. At the appropriate time, Temporize calls back to your application at the provided URL to signal that some work must be completed. If your application provided state information with the scheduling request, it will be posted back in the request entity. Whether your job has to be run every minute, the last Thursday of each month, or one time 10 months from now, Temporize will securely store and handle your application events at the right time.
By outsourcing the critical task of job scheduling you can save valuable development time, as well as infrastructure costs associated with building, deploying and running a dedicated enterprise job scheduling system.
Temporize is accessible via a simple REST API. Our API can be used with standard libraries in Java, Ruby, Python, Node.js, Clojure, Scala and more.
There are a few setup steps required to use the addon:
Temporize works by calling back to your application via HTTP POST according to a schedule constructed by you or your application. this section describes some of the basic concepts involved when scheduling events with Temporize.
There are two event types in Temporize, single and recurring.
A single event is defined by a date and time when it should be run. Temporize uses ISO8601 formatted date/time values (ex. 20130214T074238Z) both when specifying when to run a single event, and when returning event information through the API. More information is available in the Wikipedia article on ISO8601.
A recurring event is defined by a Cron schedule which provides great flexibility for defining repeating events. The format for a recurring schedule is a series of fields which represent a set of times.
NOTE: Cron expressions are resolved in the UTC time.
The Temporize format follows the standard Cron expression format.
Here are some sample expressions for recurring schedules:
A callback can fail for many different reasons. You application may be down or in the process of restarting, the may be a problem in the network connection, the application process may be hung, etc... Temporize treats any error during a connection attempt, any response that takes longer than 5 seconds, or any HTTP response code other than 2xx as a failure. When this happens, Temporize will attempt to retry the callback five times, at one hour intervals. Once the application has responded successfully (with a 2xx response code) the retries will be canceled. In addition, if the time of a retry is later than the next scheduled occurance of a recurring event, the retry will be canceled in order to prevent unexpected duplicate callbacks.
To prevent slow or broken callbacks from impacting other customers, we limit the number of times a event can fail due to error conditions or slow connections. If a recurring event fails 5 times in a row, whether due to an error condition or a slow response, it is automatically paused and execution suspended. In this case the event can be manually restarted once the problem in the customer application is rectified.
We offer several addon plans to support different requirements. Each tier has usage limits that affect the number of events which may be scheduled, as well as the number of times those events can run per day.
For each plan, there is a limit on the total number of events that can be scheduled. Once this many events are scheduled, attempts to create additional events will fail.
A plan also has limits on how many events can run in a single day. Thanks to the power and flexibility of Cron expressions recurring events are highly variable in the number of times they may run in a given day, week, month or year. To simplify usage tracking, we calculate usage by determing the average number of times per day a recurring event will excute over the next month. If the total of all the averages from all events exceeds the usage limit, attempts to create new events will fail. Each month we re-evaluate the events and will alert you if they exceed plan limits.
Please see our plan page for available plans.
Temporize can be attached to a Heroku application via the CLI:
$ heroku addons:add temporize -----> Adding temporize to sharp-mountain-4005... done, v18 (free)
Once Temporize has been added a TEMPORIZE_URL
setting will be available in the app configuration and will contain the canonical URL used to access the newly provisioned Temporize service instance. This can be confirmed using the heroku config:get
command.
$ heroku config:get TEMPORIZE_URL https://user:pass@api.temporize.net
After installing Temporize the application should be configured to fully integrate with the add-on.
Note: A list of all plans available can be found on our plan page.
Any Ruby application can use the service with freely available libraries. The following example uses HTTParty to consume the Temporize REST API.
require 'rubygems' require 'httparty' require 'cgi' require 'time' class Temporize include HTTParty base_uri 'https://api.temporize.net/v1' format :json attr_accessor :credentials def initialize(username, password) @credentials = {:username => username, :password => password} end # Check that we can call web service def test Temporize.get("/test") end # Check authentication def auth Temporize.get("/auth", :basic_auth => credentials) end # Schedule a test event to run right away def single date = Time.now.utc.iso8601 url = CGI::escape("http://example.com/callback") # Replace with your callback URL Temporize.post("/events/#{date}/#{url}", :basic_auth => credentials) end # Schedule a test event to run once a day at 10:05AM GMT def recurring cron = CGI::escape("5 10 * * ?") url = CGI::escape("http://example.com/callback") # Replace with your callback URL Temporize.post("/events/#{cron}/#{url}", :basic_auth => credentials) end end
The Temporize API is fully accessible from the command line using an HTTP client such as Curl:
$ curl -k https://user:pass@api.temporize.net/v1/events ["QUzSPKFxTiWb48EZeQ4KUv","htN8esKtQKqgfpNA5rcDbQ"] $ curl -k https://user:pass@api.temporize.net/v1/events/QUzSPKFxTiWb48EZeQ4KUv { "id": "QUzSPKFxTiWb48EZeQ4KUv", "account": "eiKKvxfVSmyqHcV4E6xYvQ", "user": "eiKKvxfVSmyqHcV4E6xYvQ", "status": "Active", "retries": 5, "url": "http://api.temporize.net/v1/test", "when": "2014-02-13T20:12:43Z" }
Use the heroku addons:upgrade
command to migrate to a new plan.
$ heroku addons:upgrade temporize:newplan -----> Upgrading temporize:newplan to sharp-mountain-4005... done, v18 ($49/mo) Your plan has been updated to: temporize:newplan
Temporize can be removed via the CLI.
$ heroku addons:remove temporize -----> Removing temporize from sharp-mountain-4005... done, v20 (free)
For support please email us at: support@temporize.net