I’m parsing remote JSON data into MongoDB, Actually i’m parsing dynamic JSON data,but i want to update MongoDB for every 30 Sec with dynamic data.
parsing JSON data like this
require 'open-uri'
require 'json'
result = JSON.parse(open("url_of_json_service").read)
how i can update MongoDB for every 30sec?
Cron is great for handling recurring tasks, Means Handling long running process that executes commands at specific dates and times. As you already mentioned, database will update every 30 second.
There is great article by Ryan Bates about crob job http://railscasts.com/episodes/164-cron-in-ruby. i hope it helps you.