Giter Club home page Giter Club logo

Comments (5)

Volmarg avatar Volmarg commented on July 21, 2024 1

Personnally I ended up using this bundle : https://php-enqueue.github.io/symfony which is way easier to configure and worked out of the box with Symfony 6, rabbitMQ in RPC mode etc.

Thx, might use that too then if things start crashing.

from rabbitmqbundle.

Volmarg avatar Volmarg commented on July 21, 2024

I'll leave this here since I was fighting with the bundle for like 1.5h to make it run. The documentation is vast but it's easy to get lost in it if You are new to AMQP like me. I basically debugged the code to make it work. No idea how stable it is but at least i got now some messages in queue.

image

Symfony: 5.3.x

  1. NO need to define the producer inside config/packages/old_sound_rabbit_mq
  2. Create new class
/**
 * Needed because otherwise the bundle tries to initialize the {@see AbstractConnection} and will crush,
 * This class is basically used as replacement for {@see AbstractConnection} to fix the instantiation issue
 */
class Connection extends AbstractConnection
{

}
  1. Go to services.yaml and add this to overwrite the calls to AbstractConnection with Connection
    PhpAmqpLib\Connection\AbstractConnection: '@App\RabbitMq\Connection\Connection'
  1. The AbstractConnection requires the io argument so add to services.yaml also this
    PhpAmqpLib\Wire\IO\SocketIO:
        arguments:
            $host: '%env(RABBITMQ_HOST)%'
            $port: '%env(int:RABBITMQ_PORT)%'
  1. And now bind arguments to the Connection which replaces AbstractConnection
    App\RabbitMq\Connection\Connection:
        arguments:
            $user: '%env(RABBITMQ_LOGIN)%'
            $password: '%env(RABBITMQ_PASSWORD)%'
            $io: '@PhpAmqpLib\Wire\IO\SocketIO'
  1. Separate RABBITMQ_URL from .env to
RABBITMQ_URL=amqp://${RABBITMQ_LOGIN}:${RABBITMQ_PASSWORD}@${RABBITMQ_HOST}:${RABBITMQ_PORT}
RABBITMQ_LOGIN=guest
RABBITMQ_PASSWORD=guest
RABBITMQ_PORT=5672
RABBITMQ_HOST=localhost
  1. Create producer like that
/**
 * @description dummy test producer, nobody cares about the message. It's just for testing if producing works
 */
class TestProducer extends Producer
{
    protected $exchangeOptions = array(
        'name' => 'test',
        'type' => 'topic',



        'passive'     => false,
        'durable'     => true,
        'auto_delete' => false,
        'internal'    => false,
        'nowait'      => false,
        'arguments'   => null,
        'ticket'      => null,
        'declare'     => true,
    );

    /**
     * {@inheritDoc}
     **/
    public function publish($msgBody, $routingKey = null, $additionalProperties = array(), array $headers = null): void
    {
        parent::publish($msgBody);
    }
}

It's important to overwrite the protected $exchangeOptions by adding the name & test, else it will throw exceptions.

That's all I managed to do for now. My goal was to see if producing works, I dunno about much about the types, what name is for but it works.

from rabbitmqbundle.

Axel29 avatar Axel29 commented on July 21, 2024

Personnally I ended up using this bundle : https://php-enqueue.github.io/symfony which is way easier to configure and worked out of the box with Symfony 6, rabbitMQ in RPC mode etc.

from rabbitmqbundle.

github-actions avatar github-actions commented on July 21, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from rabbitmqbundle.

github-actions avatar github-actions commented on July 21, 2024

This issue was closed because it has been stalled for 10 days with no activity.

from rabbitmqbundle.

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.