'What's the difference between Google Cloud Scheduler and GAE cron job?
After reading the docs
- cloud scheduler - https://cloud.google.com/scheduler/
- GAE cron job - https://cloud.google.com/appengine/docs/flexible/nodejs/scheduling-jobs-with-cron-yaml
- cloud function pub/sub trigger - https://cloud.google.com/functions/docs/calling/pubsub
I think they are mostly the same.
I can use GAE cron job + pub/sub + cloud function to implement the same functions which cloud scheduler has.
In my understanding, it seems there are some differences between them:
Cloud Scheduler can be more convenient to adjust frequency. To update the frequency of
GAE cron job, you must update the config, likeschedule: every 1 hoursofcron.yamland redeploy.There is no need to implement the cron job architecture(integrate
GAE,GAE cron service,pub/sub,cloud function, etc..) by yourself which means you don't need to write code for combining them together anymore.
Am I correct? Or, any other differences?
Solution 1:[1]
it seems that you want to create a CSV file. My advice is to use ";" as a separator for the split() command, and if the file is not too big, read the whole file, put it into an arrayList of Strings and then manipulate It, rewriting the whole file at the end from the arrayList. Otherwise you have to use RandomAccess class
Solution 2:[2]
Replacing string in file is not so simple. You have to read whole file and rewrite part that you want to leave unchanged. Only when condition of comparing userID and data[0] is met, you would use replace() function to change user balance.
Your file is basically CSV file with space as line separator, as already mentioned store file contents in array or BufferedReader, change appropriate line and then export back to CSV.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Paki |
| Solution 2 |
