0

When I try to publish a message to rabbitmq default exchange I receive error: "ACCESS_REFUSED - operation not permitted on the default exchange"

I use

  • symfony 4.2
  • php-amqplib/rabbitmq-bundle 1.14
  • rabbitmq server 3.6.16

Producer config in symfony old_rabbit_mq.yaml:

producers:
        default.exchange:
            class: App\Producer\DefaulExchangeProducer
            connection: default
            exchange_options: {name: '', type: direct}




consumers:
          rsg.product.resealed.rbh:
              connection:       default
              exchange_options: {name: 'rsg-core.resealed_parent_link', type: fanout}
            queue_options:    {name: 'vin.rsg.product.vendor.resealed'}
            callback: App\Consumer\Rsg\RsgProductResealedConsumer

Scritp used to push message:

class PublishToQueueCommand extends Command
{
    protected static $defaultName = 'app:publish-to-queue';

    private $producer;


    public function __construct(DefaulExchangeProducer $producer)
    {

        $this->producer = $producer;

        parent::__construct();
    }

    protected function configure()
    {
        $this
            ->setDescription('Publishes a message to a queue');
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {

        // Publish the message to the queue
        $this->producer->publish('my message', 'vin.rsg.product.vendor.resealed');

        return 1;
    }
}

Permisions for virtual host for user in rabbitmq server:

Configure regexp ., Write regexp .,Read regexp .*

I can do this from rabbitmq web interface.

0 Answers0