大佬教程收集整理的这篇文章主要介绍了尽管处理程序显示在调试器中,但未处理 Symfony 消息,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
正如标题所说,我在 Symfony 中的消息没有被处理。一点也不。甚至没有出现错误。
所以我的信使配置是完全默认的。但是我设置了多条总线,如下所示
services:
# default configuration for services in *this* file
_defaults:
autowire: true # automatically injects dependencIEs in your services.
autoconfigure: true # automatically registers your services as commands,event subscribers,etc.
# makes classes in src/ available to be used as services
# this creates a service per class whose ID is the fully-qualifIEd class name
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
- '../src/Tests/'
# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
App\Controller\:
resource: '../src/Controller/'
Tags: ['controller.service_arguments']
# add more service deFinitions when explicit configuration is needed
# please note that last deFinitions always *replace* prevIoUs ones
###MESAGE BUS
_instanceof:
App\App\Shared\Domain\Bus\CommandBusHandler:
Tags: [{ name: messenger.message_handler,bus: command.bus }]
App\App\Shared\Domain\Bus\queryBusHandler:
Tags: [{ name: messenger.message_handler,bus: query.bus }]
App\App\Shared\Domain\Bus\EventBusHandler:
Tags: [{ name: messenger.message_handler,bus: event.bus }]
command.bus.dispatcher:
class: App\App\Shared\Infrastructure\Symfony\messageBus
arguments:
$messageAllowedType: 'App\App\Shared\Domain\Bus\message\CommandmessageInterface'
query.bus.dispatcher:
class: App\App\Shared\Infrastructure\Symfony\messageBus
arguments:
$messageAllowedType: 'App\App\Shared\Domain\Bus\message\querymessageInterface'
event.bus.dispatcher:
class: App\App\Shared\Infrastructure\Symfony\messageBus
arguments:
$messageAllowedType: 'App\App\Shared\Domain\Bus\message\EventmessageInterface'
App\App\Shared\Infrastructure\Symfony\BlackBirdmessageBusInterface $commanddispatcher: '@command.bus.dispatcher'
App\App\Shared\Infrastructure\Symfony\BlackBirdmessageBusInterface $query: '@query.bus.dispatcher'
App\App\Shared\Infrastructure\Symfony\BlackBirdmessageBusInterface: '@event.bus.dispatcher'
我的 bin/console deBUG:mess
输出是:
我在课堂上注意到的:\Symfony\Component\Messenger\Handler\HandlersLocator
空数组在构造函数中作为处理程序列表传递。
我在 5.2 版本中使用 symfony 和 symfony/messenger
以及我的调度员代理(如果重要):
class messageBus implements BlackBirdmessageBusInterface
{
private messageBusInterface $messageBus;
private TranslatorInterface $translator;
private String $messageAllowedType = ''; //if empty allow all types
public function __construct(
messageBusInterface $messageBus,TranslatorInterface $translator,String $messageAllowedType = ''
)
{
$this->messageBus = $messageBus;
$this->translator = $translator;
$this->messageAllowedType = $messageAllowedType;
}
public function publish(array $events): voID
{
foreach ($events as $event) {
$this->dispatch($event);
}
}
public function dispatch($message,array $stamps = []): Envelope
{
// $this->guardmessageType($messagE);
return $this->messageBus->dispatch($message,$stamps);
}
private function guardmessageType($messagE)
{
if (false === empty($this->messageAllowedTypE) && false === is_a($message,$this->messageAllowedTypE)) {
throw new \LogicException($this->translator->trans('dispatcher.wrong_message'));
}
}
}
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的尽管处理程序显示在调试器中,但未处理 Symfony 消息全部内容,希望文章能够帮你解决尽管处理程序显示在调试器中,但未处理 Symfony 消息所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。