0

I wanna use kafka and rabbitmq at the same time in my symfony project. Any chance i can do it? I'm using docker-compose for my project

  rabbitmq:
    image: rabbitmq:3-management
    environment:
      - RABBITMQ_DEFAULT_USER=rabbitmq
      - RABBITMQ_DEFAULT_PASS=rabbitmq
    ports:
      - "5672:5672"
      - "15672:15672"
  kafdrop:
    image: obsidiandynamics/kafdrop
    ports:
      - "9000:9000"
    depends_on:
      - kafka

  kafka:
    image: obsidiandynamics/kafka
    ports:
      - "2181:2181"
      - "9092:9092"

and in my docker file

&& yum -y install ... \
                  ... \
                  ... \
                  librabbitmq-devel \
                  ... \
                  librdkafka-devel \
&& pecl install amqp \
&& echo -e "extension=amqp.so" > /etc/php.ini \
&& pecl install rdkafka \
&& echo -e "extension=rdkafka.so" > /etc/php.ini \

looks like it's working, but sometimes I got messages like this:

You cannot use the "Symfony\Component\Messenger\Bridge\Amqp\Transport\Connection" as the "amqp" extension is not installed.

Any ideas on how to fix this?

Valera
  • 43
  • 6
  • Have you definetely installed the https://pecl.php.net/package/amqp extension? As in, you have checked that it does exist. php -m will list modules. – Ne Ma Sep 01 '23 at 08:28
  • Yeah, it looks like it. If you install them all separately, everything works correctly. Any ideas how to install them together? @NeMa – Valera Sep 01 '23 at 08:37
  • I would not install them together. I would have seperate RUN statements for individual extensions. That way it allows you to isolate issues when creating the container. – Ne Ma Sep 01 '23 at 10:34
  • @Valera You are rewriting your ini instead of appending to it, that is the reason the amqp extension is not loaded. Append it, have a look at https://stackoverflow.com/questions/6207573/how-to-append-output-to-the-end-of-a-text-file – Hisham Sep 01 '23 at 14:50

0 Answers0