Slide 1

Slide 1 text

Utilizando Filas com PHP

Slide 2

Slide 2 text

Ivan Rosolen Faculdade, Pós Graduação, Cursos e bla bla bla Desenvolvedor a 15+ anos Autor de vários PHPT (testes para o PHP) Entusiasta de novas tecnologias Membro ativo do PHPSP Head of Innovation @ Arizona CTO @ Mokation

Slide 3

Slide 3 text

@ivanrosolen

Slide 4

Slide 4 text

AMQP

Slide 5

Slide 5 text

- Advanced Message Queueing Protocol - Messaging Broker - Network Protocol - Platform Agnostic - Port 5672

Slide 6

Slide 6 text

Advantages

Slide 7

Slide 7 text

- Get data from a to b - Asynchronous - Load balance and scalability - System integrations - Retry

Slide 8

Slide 8 text

Model

Slide 9

Slide 9 text

Publisher Consumer Exchange Queue Routes Consumes Publish

Slide 10

Slide 10 text

Components

Slide 11

Slide 11 text

- Exchanges - Message Queues - Bindings - Channel - Virtual Host

Slide 12

Slide 12 text

Exchange

Slide 13

Slide 13 text

- Routing agent - Binding - Routing key

Slide 14

Slide 14 text

- Direct exchange - Fanout exchange - Topic exchange - Headers exchange

Slide 15

Slide 15 text

Exchange Queue 1 routing_key: key1 Queue 2 Queue 3 routing_key: key2 routing_key: key3 Direct

Slide 16

Slide 16 text

Exchange Queue 1 Queue 2 Queue 3 Fanout

Slide 17

Slide 17 text

Exchange Queue 1 routing_key: app1.upload Queue 2 routing_key: *.download routing_key: #.download Topic

Slide 18

Slide 18 text

- Headers - Slower - More than one criteria for forwarding

Slide 19

Slide 19 text

Queue

Slide 20

Slide 20 text

- Durable or Temporary (server shutdown) - Fifo? - Dead letter - Named by client or Server - reply_to

Slide 21

Slide 21 text

Bindings

Slide 22

Slide 22 text

- Relationship - Queue X Exchange X Virtual Host

Slide 23

Slide 23 text

Channel

Slide 24

Slide 24 text

- TCP - SSL - Lightweight connections that share a single TCP connection

Slide 25

Slide 25 text

Virtual Host

Slide 26

Slide 26 text

- /virtual_host - Queue/exchange groups

Slide 27

Slide 27 text

Producer

Slide 28

Slide 28 text

- Batch - Send message to an exchange

Slide 29

Slide 29 text

Consumer

Slide 30

Slide 30 text

- basic_ack - Worker(s)

Slide 31

Slide 31 text

RabbitMQ

Slide 32

Slide 32 text

- PECL and Composer - Easy to install, use and monitor - Great docs - Plugins - Open source and commercially supported

Slide 33

Slide 33 text

Code

Slide 34

Slide 34 text

Refs

Slide 35

Slide 35 text

Github https://github.com/ivanrosolen/queues-and-php RabbitMQ https://www.rabbitmq.com https://www.rabbitmq.com/getstarted.html https://www.rabbitmq.com/devtools.html https://github.com/rabbitmq PHP AMQP https://github.com/php-amqplib/php-amqplib

Slide 36

Slide 36 text

????

Slide 37

Slide 37 text

Obrigado! https://joind.in/talk/2bef6 Visite phpsp.org.br