如何在Shopware 6中安排任务6
我创建了一个自定义计划的任务。我也使用以下教程进行了注册: 但是,在我的数据库中,此任务的状态仍然是“排队”的,而不是“计划的”。这阻止了任务执行。如何解决这个问题?我目前正在Localhost工作。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我创建了一个自定义计划的任务。我也使用以下教程进行了注册: 但是,在我的数据库中,此任务的状态仍然是“排队”的,而不是“计划的”。这阻止了任务执行。如何解决这个问题?我目前正在Localhost工作。
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
状态
排队
表示执行该任务的消息已分派到消息队列。如果状态没有自动改变,则表明现在工作线程执行了队列中的消息。默认情况下(对于开发设置!)有一个 AdminWorker,只要在浏览器中打开了商店管理,它就会轮询并执行队列中的消息。您还可以通过 CLI 手动启动工作程序:
您可以在 官方文档。
Status
queued
means that a message to execute that task was dispatched to the message queue. If the status does not change automatically that indicates that now worker executed the messages from the queue.By default (for dev setups!) there is a
AdminWorker
, which will poll and execute messages from the queue as long as the shopware administration is open in a browser. You can also start a worker manually per CLI:You can find more information how to work with the message queue and how to start workers in the official docs.
我遇到了完全相同的问题。
创建并注册任务后,它在数据库中显示为“排队”,因此未执行。
通过手动将其更改为“计划”,然后将其执行一次,然后重新设置为“排队”。
当然,无法使用生产力。
我的错误是以下内容:
在services.xml中,我通过了处理程序的其他参数。
因此,我的处理程序具有
__ construct()
方法。但是,该类从“ ScheduleDtaskHandler”继承,该类别又具有构造函数,并期望参数“ scheduledtaskrepository”。
该存储库用于更新状态。
解决方案:
services> services> services.xml
中注入服务stere
streduled_task.repository
中的自定义处理程序parent> parent :: __ construct :: __ construct($) scheduledtaskrepository);
。最后,应该这样做:
I had exactly the same problem.
After I had created and registered my task, it was displayed in the database as "queued" and accordingly not executed.
By manually changing it to "scheduled" it was then executed once and set back to "queued".
Of course unusable for productive use.
My error was the following:
In the services.xml I had passed additional parameters for my handler.
Accordingly my handler had a
__construct()
method.However, the class inherits from "ScheduledTaskHandler" which in turn also has a constructor and expects the parameter "scheduledTaskRepository".
This repository is used to update the status.
The solution:
scheduled_task.repository
in theservices.xml
into your custom handlerparent::__construct($scheduledTaskRepository);
.In the end it should like this: