I am creating a web app in Grails and I would like to continuously (every 5 minutes or so) poll a REST service using GET, which retrieves a series of messages (or possibly none, it depends) and once it is donde, my application should save the retrieved data as an object and store it in my database. The problem is that I have no idea how I should implement it (with a cron job using Quartz?)
A cron job using quartz would be really easy to implement. The quartz plugin is very easy to use (just install it and then "grails create-job Foo"). Inside the task, you can use a cron expression (or a number of other ways) that will cause the job to get executed based on the schedule.
Depending on a few things, the GET expression is also very easy to write. Depending on the service you're trying to hit it could be as easy as:
def result = new URL("http://google.com").text
// parse result depending on what it is
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With