Manually schedule job from another application. #1281
-
I have a Rails application and a Python Discord bot both accessing the same PostgreSQL database. I want to schedule a job from the Python bot. If I add an entry to the "good_job" table, will it be picked up? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can. New records inserted into the You shouldn't. That would end up coupling the two services via the database, which would make upgrades and deployment more difficult. Also you'd need to manage both GoodJob updates and Rails updates may modify the contents of Instead, I'd recommend making a simple HTTP API with a shared secret, or using Twirp/gRPC. |
Beta Was this translation helpful? Give feedback.
You can. New records inserted into the
good_jobs
table will get picked up on polling. You could also reverse engineer and use NOTIFY too.You shouldn't. That would end up coupling the two services via the database, which would make upgrades and deployment more difficult. Also you'd need to manage both GoodJob updates and Rails updates may modify the contents of
serialized_params
(how Active Job serializes the job data). It would be hard.Instead, I'd recommend making a simple HTTP API with a shared secret, or using Twirp/gRPC.