Grettings everyone,
We are using AWS as PaaS and we have a couple of microservices deployed there. We got some new requirements to use some sort of cron jobs and schedulers.
For example we have the following scenarios:
A user can set some rules when an event must happen. For example he wants to remove some oudated documents every Friday or once a week or every 2 days
A user can configure creating copies of some objects every day till date A
I used to use Quartz before and it is the first idea that comes in my mind. I think that we can use it in AWS, cause it has RDS(with PostgreSQL for instance).
But I would like to know what sort of other options can I use instead of Quartz(http://www.quartz-scheduler.org) + RDS? May be AWS has something out of the box that can do the same?
What do you think about http://docs.aws.amazon.com/batch/latest/userguide/what-is-batch.html in my case?
Thank you for your time and advice :)
Recently(10-Nov-2022) AWS launched a new service called EventBridge Scheduler and I've already added a detailed answer here, please have a look. So you don't need to handle anything manually Because EventBridge Scheduler is serverless.
Related
I am trying to write ATDDs for a batch job. The job has the following scenario:
It checks the DB and if some event has been recorded 7 days back, it will pick up that event and reprocess. Here, 7 days is the pre-requirement to process it. While reprocessing, the system will interact with multiple services.
So, here I have to create this scenario through my ATDDs and want to verify if the job ran successfully.Means my ATDDs have to create specific data with the creation date as 1 week older.
I have enough experience with ATDDs with Cucumber+Java so want to work on same. Could someone give some idea whether it could be achieved?
In the Play!-framework, code is triggered by requesting a URL from the server. The thing is, I need to have some code in the background running continuously from start-up, polling a database for new entries every few minutes, as if it were a normal program with a main() function. As far as I can tell the only way to run code is to navigate to a URL, but that's not what I want here. Any way to accomplish this?
Sounds like you want to use some kind of cron task (correct me if I'm wrong)
In Play 2.x it's done with Akka's scheduler mentioned in the docs
Even more informations and/or samples you can find on the original Akka's docs
In general: in Play you can just schedule some task in the onStart() method of the Global class and then repeat in desired duration as long as required.
Edit: of course Akka is built-in the Play 2.x from the very beginning, actually we could say that Play is built on top of the Akka ;)
A part of my program needs to simulate a GPS. So I am setting up a client-server connection. Where on server my main application would run and on client it would send the GPS string periodically after a particular time interval. I am using JAVA for programming it and I am a bit new to networking area, so if someone can just give me an idea about How do i send my data periodically? The emphasis is on just one part. Periodically after a time interval.
you can use TimerTask Class for your solution. Here is a very useful link for its example.
In its run method you need to deploy your uploading code.
I am also working on same kind of project right now.
Add a java timer to your code that triggers at the interval you specify. In the timer handler, just run some code to send data to the server.
Use a TimerTask with a Timer.
Although your requirement might be simple enough, but i suggest you take a look into quartz scheduler.
It supports from plain simple timer tasks (like every minute or every xx seconds) to the more complex timing scenarios.
Here is one simple example that you can dive more deeply from the source code.
I have a table in database with users and their expenses for traveling. I am using GWT and want to run a code once a month, that would query the database and send bills as PDFs to customers. I know how to create PDFs and send emails from servlet.
How to run a program in java (or some other script if it isn't possible with java) that would run once a month?
Tnx
Unix and derivatives: use cron -> http://en.wikipedia.org/wiki/Cron
Windows: use task scheduler -> http://support.microsoft.com/kb/308569
If you want to get fancy and do it purely in java: -> http://www.quartz-scheduler.org/, but do consider OS scheduler first.
you have many choices.
If you are under Unix, the simpliest solution is a batch scheduled with a crontab.
If you prefer a 100% java solution, the Quartz framework is a robust a easy to setup solution.
To avoid "re-inventing the wheel" I suggest using http://www.freshbooks.com/ and tying your app into their API to send your bills. You can easily set up recurrence as a billing option so that the bills get re-sent (along with reminders) each month. The user can then grab the PDF version of their bill.
I want to run my java program in regular interval , lets say, in every 3 hours. I am thinking to write a .bat file and put command to call java class. But what is the best way to run .bat regularly in windows xp. Thanks in advance. I dont want to use third party tool.
Windows scheduled tasks are built for exactly that purpose.
You can run things on multiple schedules (so you can get your every-three-hour behaviour) and you can get your code to run whether or not logged in.
The multiple scheduling is a bit tricky. You basically set it up as a daily task to start with but, near the end, it will ask you if you want to do advanced features.
Select yes then you can set up multiple schedules at that point.
If you want a pure Java Based solution you can try QUARTZ SCHEDULER. But as paxdiablo already mentioned, Windows Task Scheduler will do that as well.