I want to create a cron job in my rails application.
for example:
def job(message)
send_message_to_someother_service(message)
end
This job will take input parameters and run against a cron expression. Now I will be sending requests to my rails app to add more cron expression, input parameters pair. (Lets say that these will be stored in DB)
for example:
[
{cron: (0 0/1 * 1/1 * ? *), parameters: {message: "test1"}},
{cron: (0 0/5 * 1/1 * ? *), parameters: {message: "test2"}
]
My job should run for all the cron expressions with corresponding input parameters.
Expected behaviour: The other service just prints the message it receives with the time stamp
[12:00:00]: test1
[12:00:00]: test2
[12:01:00]: test1
[12:02:00]: test1
[12:03:00]: test1
[12:04:00]: test1
[12:05:00]: test1
[12:05:00]: test2
Can anyone help me to acheive this?