I'm using @Scheduled annotation to schedule a job in Spring Boot. My code is running in Kubernetes cluster. Job is working fine, but when I start multiple pods, each pod starts running the job at the given time. I want only one to run the job. Read about Shedlock but it doesn't seem to work with Firestore database. Is there a way to achieve this behaviour with Firestore database?
How to run job in only one pod using @Scheduled in Spring Boot
1.1k Views Asked by Abhinandan Sharma At
1
There are 1 best solutions below
Related Questions in GOOGLE-CLOUD-FIRESTORE
- How to Querying Nested Arrays in Firestore with Firebase Admin Python
- Why do I need to wait to reaccess to Firestore database even though it has already done before?
- Kotlin Version Error in Integration of Firebase
- Can Anyone help me to load pdf file from firebase to user app by URL in jetpack compose?
- Setting document field value using Firestore Functions
- Exists not working in Firebase Security Rules
- Stripe subscriptions - When testing clocks, an automatic invoice with status paid is getting created on advancing time
- Nonsense error using a Python Google Cloud Function
- Updating existing document in Firebase using Flutter causes Lost Of Connection to the Simulator
- run dart script from firestore cloud functions
- Saving Dates Into Array for Uploading to a Firestore Document
- Firebase read from the database resulting in repeating the contents of last uploaded document instead of all documents
- How to get data as different subcollections and documents from firebase?
- How to Automatically Generate IDs in Kotlin with Firebase?
- Is it possible to combine Firestore streams in Flutter?
Related Questions in SPRING-BATCH
- How to customize the Spring Batch default configuration without breaking autoconfiguration
- Is there any catch in Reading and Updating to the same Oracle table in Single Threaded Spring batch job?
- Starting first job causes - Dispatcher has no subscribers for channel exception when declared multiple DirectChannels
- Looping Over a Group of Steps in Spring Batch
- Already value [datasource.ConnectionHolder@6b144bd8] for key [datasource.DriverManagerDataSource@56739ee9] bound to thread [main]
- How to Use ControllerAdvice for Exception Handling in Spring Batch Application?
- Writing in multiple related tables in spring batch
- Restarting a FAILED job is not processing the failed chunk data again : Continuation
- Spring Batch Not persisting Data Properly in MYSQL Database
- Strange Spring Batch exception, something I did wrong?
- Parameter 0 of method jobBean in com.nextuple.BatchProcessing.config.BatchConfig required a bean named 'dataSource' that could not be found
- is spring batch supports parquet file reading and writing
- Spring Batch 5 - Don't want it to automatically create tables in database
- Transaction flow for distributed transaction in Spring Batch
- How to solve JobBuilder deprecated in SpringBatch 5.1.1
Related Questions in SPRING-SCHEDULED
- Spring @Scheduled cron fixed time doesn't work with OS suspension
- Spring scheduled - can I join fixed delay with cron
- Set cron schedule from properties file rather than hard coding it and still avoid Attribute value must be constant
- Spring job doesn't store JPA entity to DB and doesn't throw any exception even if table is not exist
- multiple jobs to be run by a scheduler and locking
- @Scheduled with cron job needs to run in ONE instance ONLY
- Send message from server to client use Websocket. Java
- Scheduled methods in Multimodule Spring Boot Gradle project are not getting executed
- How to wait until the scheduled task completes execution
- Spring Boot @Scheduled annotation: Start and end at top of hour?
- Schedule job dynamically using record in Database in Springboot
- Http Request from Spring Boot 3 Scheduled Jobs
- Spring schedule - dynamically start and stop a task
- My java class unable to run @Scheduled cron annotation
- Spring graceful shutdown not waiting for scheduled tasks with thread sleep
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
First, why would you want to scale your scheduled job? scheduled job should not be scaled. It's better if you separate it with the micro-service arc in mind.
if your concern is price, so that you want to combine your scheduled job with other services, I dont think that
Firestorecould help you in this case. Rather, you could change your scheduler into a Http server, and useGoogle Cloud Schedulerto invoke your pod.