I need to create a webjob that runs 2 processes (maybe more). All the time.
Process 1 (Continuous)
- Get messages from the queue
- for each message connect to db and update a value.
- repeat 1
Process 2 (schedule - every day early in the morning)
- Go to db and move records a tmp table
- Send each record vía HTTP
- if a record cant sent, retry for all day.
- if all records were sent, run again tomorrow
According to the 2 processes (should be more), Can I create one single web job for all processes ? or should I create a single job for each process?
I was thinking about this implementation, but I don't know how accurate it is.
crojobs: 1
Type: Continuous
while(true){
process1();
process2();
}
async function process1() {
// do staff
}
async function process2() {
// do staff
// node-cron lib schedule: (every early morning day)
}