Automated monthly induvidual emailed reports to ~1000 users



  • Hi!
    Im trying to find a solution to our reporting needs. Looking to send individual reports via emails to about 1000 clients. I've played around with jsreport some, and been able to create a template that should work for us, and I've also read through your tutorial covering this case and it all looks very straight forward and pleasurable to work with.

    However - I have some questions on how to approach setting this up in production with this many individual subscribers. I'd like for jsreport to pull data from a API i plan to implement for the purpose.

    I could include all data in one big JSON with one object for each customer with the customer email as one of the fields, but I have not found any way to render several reports from the same "beforeRender" function. I guess I could also set up the "slicing" outside of jsreports and push one client at the time to jsreport, but then how would I know how to send requests at the optimal time to not choke the server?

    Im sure there are simple solutions to my issues - any pointers on where to look?


  • administrators

    hi, first of all thanks for taking a look at jsreport.

    I could include all data in one big JSON with one object for each customer with the customer email as one of the fields, but I have not found any way to render several reports from the same "beforeRender" function. I guess I could also set up the "slicing" outside of jsreports and push one client at the time to jsreport, but then how would I know how to send requests at the optimal time to not choke the server?
    Im sure there are simple solutions to my issues - any pointers on where to look?

    if i would have to do something like this, i would do it like this:

    • make an API that gives me the list of all users that needs a report in this month (all users with a pending report)
    • somehow create in my own backend a cron task that query that API and that makes a jsreport request for each user record, the data sent to jsreport will have all data that the report needs to generate the report for that specific client in that month. then just wait until report is finished
    • in my cron task after my report is finished and i get a response from jsreport, update my database to mark a user from "pending report" to "report sent" for this particular month.

    the good thing about this is that if you have a total of 1000 report requests and for some reason 100 fails, then you will be able to re-try those 100 report request in your cron task. you can even limit the amount of records that your cron task can process in each interval, let's say that you will always try to prepare 500 reports each 5 minutes and process things in chunks if you are worried about choking the server.



  • Thanks for your prompt reply. I'll go ahead and make some scripts on the outside calling jsreport pr client as you suggest. Should not be overly complex, was just wondering of there already was a way to handle this as an integrated part of jsreport.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.