dongqia3502
2017-10-13 13:27
采纳率: 100%
浏览 187
已采纳

如何在基于Laravel的应用程序中处理大量PDF生成并通过电子邮件发送它们

I'm just curious how would you handle a scenario where a lot of PDF's has to be generated on the server and be send to the user by email. You're not able to temper with the PDF because it needs to be 100% secure or close to that number.

For example the PDF contains the order you just made in a webshop, proof of purchase or something like that.

The application will have a lot of concurrent users. For this question I will use Laravel as a base platform for the web application.

I had the idea of running a cron job at night that will generate all this PDF's at once and send per e-mail.

What is considered best practise in this scenario?

图片转代码服务由CSDN问答提供 功能建议

我只是好奇你将如何处理必须在服务器上生成大量PDF的场景 通过电子邮件发送给用户。 您无法使用PDF进行调整,因为它需要100%安全或接近该数字。

例如,PDF包含您刚在网店中制作的订单,证明 购买或类似的东西。

该应用程序将有很多并发用户。 对于这个问题,我将使用Laravel作为Web应用程序的基础平台。

我有一个想法是在晚上运行一个cron作业,它将立即生成所有这些PDF并按发送 -邮件。

在这种情况下,最佳做法是什么?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doulu6929 2017-10-13 14:13
    已采纳

    For example the PDF contains the order you just made in a webshop, proof of purchase or something like that.

    Given that these will presumably occur throughout the day, a queue may be a better solution than a cron. Every time someone does an action that'd require a PDF, fire off a queue job. A background process will check for queued jobs and process them.

    This avoids having a giant backlog, protects you in the case a cron fails, and gets PDFs out to the clients in a more timely fashion.

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题