Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Working with RabbitMQ and PHP with PHP-AmqpLib

Working with RabbitMQ and PHP with PHP-AmqpLib

Presentation from the RabbitMQ Summit Pre-Conference.

BRUNO SOUZA

July 07, 2021
Tweet

More Decks by BRUNO SOUZA

Other Decks in Technology

Transcript

  1. Web Developer and Software Engineer since 2011. Brazilian living in

    Ireland. Data Science and DevOps student. Member of PHP DF and PHP Dublin community. Speaker, Father and Guitar player WHO AM I? @Bruno_HSouza
  2. • Context of the Use Case • Concepts for Message

    Systems • Use Case Scenario • PHP-AMQP-LIB • Conclusion
  3. • Is a technology that enables a communication with: ◦

    High-speed; ◦ Synchronous and/or asynchronous approach; ◦ Point-to-point (P2P); ◦ Messages (packs of data) between applications; Messaging System
  4. • Is an messaging open-source protocol that enables applications to

    communicate with messaging brokers; • Defines both the network layer protocol and a high-level architecture for message brokers AMQP - Advanced Message Queuing Protocol
  5. • Acts as a buffer that stores messages that are

    consumed later; ◦ Name; ◦ Durable; ◦ Exclusive; ◦ Auto-delete; ◦ Arguments (TTL, length limit) Queues
  6. • Entities where messages are sent; • Take a message

    and route it into zero or more queues; • Can have some types like: ◦ Direct; ◦ Fanout; ◦ Topic; ◦ Headers; Exchanges
  7. • is a relation between a queue and an exchange

    consisting of a set of rules that the exchange uses to route messages to queues; Bindings (routes)
  8. • Is a virtual connection inside a connection, between two

    AMQP peers. • Message publishing or consuming to or from a queue is performed over a channel (AMQP). • A channel is multiplexed, one single connection can have multiple channels. Channel
  9. • Faster than any other library due to its native

    extension written in C; • Already implemented in the application; • Do not offer support to consume messages in a non-blocking way; • Can not listen to posix signals while consuming; Native AMQP Driver
  10. • Simple (or Streaming) Text Orientated Messaging Protocol; • Simple

    and easy to implement; • Provides an interoperable wire format to communicate with any message broker; • Frame based protocol, with frames modelled on HTTP; • Do not offer support to consume messages in a non-blocking way; Stomp Driver
  11. • Consume messages in a non-blocking way on our ESB;

    • Implement a driver with support to Posix signals; A new challenge
  12. • To find a way to implement a non-blocking consume()

    function with the native driver • Implement a new driver with support to Posix signals; • Work with Symfony Messenger and change our architecture; Possible Solutions
  13. It worths to adapt the library PHP-AMQPLIB into the framework

    even with a lot of work and creation of a second version of the app Decision
  14. • This library is a pure PHP implementation of the

    AMQP 0-9-1 protocol. • It's been tested and used for examples by RabbitMQ; • Offers the possibility to consume messages in a non-blocking way; • Signals can be dispatched to the worker even if it's consuming messages; • Offers other options like: heartbeats, channels, respect POSIX signals, and multiple hosts PHP-AMQPLIB