首页 > 解决方案 > 我的 SuluSyliusConsumerBundle 配置有什么问题?

问题描述

我有一个 Sulu 和一个 Sylius 应用程序,我正在尝试使用 SuluSyliusBundle 和 RabbitMQ 进行集成。我添加了以下配置...

信使.yaml

framework:
router:
    resource: "%kernel.project_dir%/config/routing_%sulu.context%.yml"
messenger:
    # Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
    # failure_transport: failed
    buses:
        message_bus:
            middleware:
                - doctrine_transaction
                - event_middleware
    # Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
    # failure_transport: failed

    transports:
        # https://symfony.com/doc/current/messenger.html#transport-configuration
        # async: '%env(MESSENGER_TRANSPORT_DSN)%'
        # failed: 'doctrine://default?queue_name=failed'
        # sync: 'sync://'

    routing:
        # Route your messages to the transports
        # 'App\Message\YourMessage': async

sulu_sylius_consumer.yaml

  sylius_base_url: 'http://127.0.0.1:8001'
  sylius_default_channel: 'default_channel'
  sylius_oauth_config:
    username: api
    password: api
    client_id: demo_client
    client_secret: secret_demo_client
  route_defaults_fallback:
    view: 'templates/products/default'
  firewall_provider_key: 'main'

问题是,一旦我安装了捆绑包并添加了这两个配置,就会出现以下错误 在此处输入图像描述

我相信这是由信使中的配置引起的。我已将路由添加到 routes_admin.yaml,因为它在此处的文档中显示:

routes_admin.yaml


app_events:
    type: rest
    resource: App\Controller\Admin\EventController
    prefix: /admin/api
    name_prefix: app.
    options:
        expose: true

app_event_registrations:
    type: rest
    resource: App\Controller\Admin\EventRegistrationController
    prefix: /admin/api
    name_prefix: app.
    options:
        expose: true

app_locations:
    type: rest
    resource: App\Controller\Admin\LocationController
    prefix: /admin/api
    name_prefix: app.
    options:
        expose: true

app_products:
    type: rest
    resource: App\Controller\Admin\ProductsController
    prefix: /admin/api
    name_prefix: app.
    options:
        expose: true

sulu_route:
    mappings:
        Sulu\Bundle\SyliusConsumerBundle\Model\RoutableResource\RoutableResource:
            generator: schema
            resource_key: product_content
            options:
                route_schema: "/products/{object.getCode()}"

routes_website.yaml

app.event:
    path: /{_locale}/event/{id}
    controller: App\Controller\Website\EventWebsiteController::indexAction

app.product:
    path: /{_locale}/product/{id}
    controller: App\Controller\Website\ProductWebsiteController::indexAction

我能做些什么来解决这个错误?[编辑:添加 routes_admin 和 routes_website yaml]

标签: symfonyrabbitmqsyliussulusymfony-messenger

解决方案


推荐阅读