Coder Social home page Coder Social logo

Comments (9)

wexotht avatar wexotht commented on July 30, 2024 1

@sroze a fix for this would be nice. Still an issue meaning a lot of manual work on production environments upon setup

from messenger-enqueue-transport.

srigi avatar srigi commented on July 30, 2024

+1 to this. I'm also having problems running my consumers in production ENV. I get similar excp as @LPodolski NOT_FOUND - no queue 'transactional-emails' in vhost '/'.

There is no clear way how to pre-create queues in prod ENV. Only solution is to enable APP_DEBUG. That is just unacceptable in prod.

from messenger-enqueue-transport.

salletti avatar salletti commented on July 30, 2024

The problem is that the queue is automatically created only when debug is active, like in dev.

File: vendor/enqueue/messenger-adapter/QueueInteropTransport.php

if ($this->debug) {
      $this->contextManager->ensureExists($destination);
}

So maybe in prod you must use the command for create manually the queue:

https://github.com/php-enqueue/enqueue-dev/blob/master/docs/bundle/cli_commands.md#enqueuesetup-broker

from messenger-enqueue-transport.

makasim avatar makasim commented on July 30, 2024

The linked command has nothing to do with messenger

It is part of enqueue client library

from messenger-enqueue-transport.

salletti avatar salletti commented on July 30, 2024

In my opinion the problem concerns php enqueue library.

from messenger-enqueue-transport.

makasim avatar makasim commented on July 30, 2024

It has nothing to do with Enqueue itself, It gives you full control over what you can do.

The problem lies in this messenger adapter, its implementation.
In fact, the implementation of this adapter follows the same logic of the official amqp ext transport bundled with symfony.

https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php#L126

from messenger-enqueue-transport.

StarGuardian avatar StarGuardian commented on July 30, 2024

I bumped into the same issue and found following workaround. Wrote my own transport factory (It is basically the same except one line):
`class AmqpTransportFactory implements TransportFactoryInterface
{
private $encoder;
private $decoder;
private $debug;

public function __construct(EncoderInterface $encoder, DecoderInterface $decoder, bool $debug)
{
    $this->encoder = $encoder;
    $this->decoder = $decoder;
    $this->debug = $debug;
}

public function createTransport(string $dsn, array $options): TransportInterface
{
    return new AmqpTransport($this->encoder, $this->decoder, $this->createConnection($dsn, $options));
}

public function supports(string $dsn, array $options): bool
{
    return 0 === strpos($dsn, 'amqp://');
}

protected function createConnection(string $dsn, array $options) {
    $connection = Connection::fromDsn($dsn, $options, $this->debug);
    $connection->setup(); // <--- Workaround is here

    return $connection;
}

}`

Then I override messenger.transport.ampq.factory definition in my services.yml. It works well!

from messenger-enqueue-transport.

tdsullivan avatar tdsullivan commented on July 30, 2024

I know this is an old thread, and this isn't an optimal solution, but for anyone looking for a quick workaround, adding the following to your services definition file, to default the 'debug' argument to true, seems to do the trick.

    enqueue.messenger_transport.factory:
        class: 'Enqueue\MessengerAdapter\QueueInteropTransportFactory'
        arguments:
            - '@messenger.default_serializer'
            - '@enqueue.locator'
            - true
        tags: ['messenger.transport_factory']

from messenger-enqueue-transport.

tdsullivan avatar tdsullivan commented on July 30, 2024

Also, regarding the comments above about the official amqp ext transport, that is bundled with symfony messenger, handling this the same way, this behaviour was changed in version 4.3.

Using AMQP auto-setup in all cases, not just in debug #30579

from messenger-enqueue-transport.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.