且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP提早发送SOAP响应?

更新时间:2021-11-06 21:26:10

据我所知,我们无法对30秒的限制做任何事情,并且在脚本完成之前不会刷新输出.您可以尝试将处理逻辑分为两部分吗?

As far as I know we can't do anything about the 30 second limit and the output won't be flushed before the script finishes. Can you try splitting your processing logic into 2 pieces?

  1. 侦听器"脚本,用于接收消息,记录要完成的作业并立即发送ACK,然后退出.
  2. 您实际进行的处理可能会花费更长的时间.

要完成的工作"可能是新产生的过程(请查看 pcntl_fork()函数,但对我来说似乎不太有希望)或某种方式将数据存储在文件或数据库中并定期使用另一个脚本进行处理,例如计划每5个运行一次分钟?

The "job to be done" could be a newly spawned process (check out the comments for the pcntl_fork() function but they don't look too promising to me) or some way to store the data in file or database and periodically process it with another script, for example scheduled to run every 5 minutes?

如果60秒钟能以某种方式拯救您,则可以将出站消息重写为Apex的标注.基本上,您然后编写自己的SOAP信封并将其发送到任何http地址.您可以将其触发.有关此方法的限制,请参见此处.

If 60 seconds would somehow save you, you could rewrite your outbound message into a callout from Apex. Basically you then write your own SOAP envelope and send it to any http address. You could put it in a trigger. See here for limitations of this approach though.

其他咆哮:

  1. 我认为您的ACK不会真正影响销售人员.出站邮件只是通知.您是否在应用程序的其他地方依赖Ack = true/false?如果不是,则盲目发送ack = true&的侦听器安排工作可能真的是要走的路;)
  2. 从其他问题中我了解到,您基本上只需要将更新存储在您这边.您意识到不应将OM用于审计目的,对吗? (链接,搜索审核").
  3. 让PHP成为积极的一面会更简单吗?使它查询Salesforce的[选择ID,名称,来​​自帐户的名称,LastModifiedDate>:lastTimeYouQueried]?这样,您就可以花费所有时间来处理结果:)
  1. I don't think your ACK really "matters" to salesforce. Outbound messages are just notifications. Do you rely somewhere else in your application on Ack = true/false? If not - listener that blindly sends ack=true & schedules the job might really be the way to go ;)
  2. From the other queston I understood you basically just need to store updates in DB on your side. You realize you shouldn't use OM for audit purposes, right? (Link, search for "audit").
  3. Wouldn't it be simpler to make PHP the active side? make it query Salesforce for [SELECT Id, Name FROM Account WHERE LastModifiedDate > :lastTimeYouQueried]? That way you can take all the time you want to process the results :)