Skip to content

The value 'Vendor\Xxx5\Model\Queue\Consumer::processMessage' is not accepted by the pattern '[a-zA-Z\\]+::[a-zA-Z]+'. #16168

Closed
@weverson83

Description

@weverson83

The xml validator fail when you pass a class with numeric value in it's namespace.

Preconditions

Magento 2.2.2
magento/framework-message-queue

Steps to reproduce

  1. Create etc/queue.xml file
<broker topic="xxxx" type="amqp" exchange="magento">
       <queue consumer="yyyy" name="zzzz" handler="Vendor\Xxx5\Model\Consumer::processMessage" consumerInstance="Magento\Framework\MessageQueue\Consumer"/>
    </broker>
  1. Run bin/magento setup:upgrade

Actual result

The value 'Vendor\Xxx5\Model\Queue\Consumer::processMessage' is not accepted by the pattern '[a-zA-Z\]+::[a-zA-Z]+'.

Work arround

Created a virtualType for my class without a number in it's namespace

Solution

At vendor/magento/framework-message-queue/etc/queue_base.xsd

<xs:simpleType name="handlerType">
        <xs:annotation>
            <xs:documentation>
                @deprecated
                Handler is expected in a format "Vendor\Module\Api\ServiceName::methodName".
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:pattern value="[a-zA-Z\\]+::[a-zA-Z]+" />
            <xs:minLength value="5" />
        </xs:restriction>
    </xs:simpleType>

Fix the pattern to accept numbers (Make sure it doesn't allow start with number)
[a-zA-Z]+[a-zA-Z0-9\\]+::[a-zA-Z0-9]+ should work

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Format is not validGate 1 Failed. Automatic verification of issue format is failed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions