Salesforce Apex 并发建议
我有一个正在运行的入站电子邮件处理程序。然而,现在我担心并发问题,当用户同时为同一个对象发送两封电子邮件时。 (我有一个业务文档表单和一个发送给 salesforce 的技术文档表单。)它们包含不同的内容,除了公司名称(它们是从其他人直接发送给 salesforce 的)。
由于我在最后插入自定义对象,因此我担心并发问题。这会发生吗?我的入站电子邮件处理程序为同一家公司创建了 2 个自定义对象,并且都只填写了一半的信息。
如果是这样,我该如何防止并发问题的发生? 目前的想法: - 立即使用关联帐户而不是在最后查询 custom_object。如果 custom_object 不存在,请创建一个。
干杯,
坤
I have an inbound email handler that's working. However, right now I'm worried about concurrency issues, when a user sends 2 emails at the same time for the same object. (I have a business document form, and a technical document form that gets sent to salesforce.) They contain different things, except for the company name (They get sent over from someone else directly to salesforce).
Since I'm doing an insert of my custom object at the very end, I'm worried about concurrency issues. Will this ever happen? My inbound email handler creates 2 custom objects for the same company and both filling in only half the information.
If so, how can I prevent a concurrency problem from happening?
Current Ideas:
- Do a query for custom_object right away with the associated account rather than at the very end. If the custom_object does not exist, create one.
Cheers,
Kuen
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
传统意义上的“并发”在平台上很少成为问题。您的每一封入站电子邮件都将在平台上创建一个单独的进程(处理程序)并独立运行。如果您希望将它们结合起来,您有几个选项来处理多部分电子邮件场景:
站在你的立场上,我可能会先组合 2 个,然后再组合 3 个来清除你错过的任何内容。
"Concurrency" in the traditional sense, is rarely an issue on the platform. Each one of your in-bound emails is going to create a separate process (handler) on the platform and operate independently. You have a couple of options to deal with your multi-part email scenario though if you're looking to combine them:
In your shoes, I'd probably do a combination of 2, and then 3 to clean up any you miss.