Question is more on designing part than coding.
I have one huge File containing Mobile numbers, So what we do is read 50 numbers in one go and update the offset in database table startOffset=0 and endOffset=50. Now, start sending SMS to numbers one by one and once done, another 50 numbers are picked from file and update Offset as startOffset=51 and endOffset=100, now start sending SMS, say I have sent sms till 66 offset, PROBLEM comes when power goes off or application restart suddenly due to many reasons.
Now when application restarts, I will not come to know on what offset I have to start again (ie 67 in our case.). I will come to know that I lost in 51 to 100 chunk, So what I can do is start sending sms again from 51 but this is wrong as sms will be sent twice to number which we already sent.
Also, I can do like after sending each sms, update the currentPointer to DB, but this will make the system slow.
Can someone please suggest the best way to do this.
Aucun commentaire:
Enregistrer un commentaire