PHP with Service BUS (RabbitMQ/Redis/MongoDB) - IMasters PHP Experience 2016

Post on 07-Jan-2017

517 views 1 download

Transcript of PHP with Service BUS (RabbitMQ/Redis/MongoDB) - IMasters PHP Experience 2016

PHP with ServiceBus

Desacoplamento de Workflows com serviços de barramento utilizando RabbitMQ

40% Market Share

Plataforma de Pagamento

Nosso ecossistema

Ecossistema DLP

ONLINE

ADQUIRENTE

GATEWAY DE PAGAMENTOS

TEF / GATEWAY OFFLINE

PROCESSADORA

Pagar.me

Nossos clientes

LOJAS DEPARTAMENTO MODA ENTRETENIMENTO ALIMENTOS

Temos mais de 1500 lojas em nosso portfólio, algumas delas são as maiores marcas brasileiras e internacionais.

ÓLEO TV

www.mundipagg.com

Faça parte do nosso time!

abrandao@mundipagg.com

{ TEMOS VAGAS }

"A única maneira de fazer um excelente trabalho é amar o que você faz." (Steve Jobs)

Quer jogar?

Relaxa!! D boa, você vai achar a solução!

{ Seja criativo!! :) =)

Quer um café?

C# .Net

jQuery

PHP

Magento

Angular.js

Node.js

Gulp

Java

Ruby

SQL Server

MongoDB

Kibana

Log StashRedis

RabbitMQCassandra

Scala Akka.Net

Python

TFS

Git

ApacheJira

SentryMonitis

Python

New RelicAzure

Nosso Stack

MVC

REST

Web APIGo

Vamos dominar o mundo!!!!

Faça parte do nosso time!

abrandao@mundipagg.com

{ TEMOS VAGAS }

"A única maneira de fazer um excelente trabalho é amar o que você faz." (Steve Jobs)

Faça parte do nosso time!

querotrabalhar@stone.com

abrandao@mundipagg.com

"A única maneira de fazer um excelente trabalho é amar o que você faz." (Steve Jobs)

Alexandre Brandão

{ Microsoft C# .Net Solution Developer, C++ Linux Developer, C/C++ Embedded Programmer }

<contatos> <twitter>

@abrandaolustosa </twitter> <skype>

abrandao@mundipagg.com </skype></contatos>

Gerente de TIAnalista Desenvolvedor Sênior

Arquiteto de Sistemas

/* Linkedin: abrandaol*/

curl -data “experiencia=16_anos&motivacao=inovacao%20e%20pesquisa” https://www.mundipagg.com

Service BUS

“Definição” : “An enterprise service bus (ESB) is a software architecture model used for designing and implementing communication between mutually interacting software applications in a service-oriented architecture (SOA)”

{

}

Integraçãode

Sistemas

<wrong>Não utilize workflows centralizados e dependentes do banco de dados</wrong>

“Repense sua arquitetura”

Recursos

Pipeline – Service Bus

{ Soluções – Service Bus }

- RabbitMQ- CloudAMQP (RabbitMQ)- Azure ServiceBus- IBM MQ Series- Amazon SQS- SQL Server Service Broker- Microsoft Message Queue- OpenShift- Kafka

https://www.rabbitmq.com/

• Robust messaging for applications• Easy to use• Runs on all major operating systems• Supports a huge number of developer

platforms• Open source and commercially supported• Multiplatform for Windows, Linux and Mac OS• Erlang

RabbitMQ - SDKs

C# .Net PHP

JavaRuby

ErlangPerl

Javascript

GoPython

Scala

Haskell

The Advanced Message Queuing Protocol (AMQP) is an open standard application layer protocol for message-oriented middleware. The defining features of AMQP are message orientation, queuing, routing (including point-to-point and publish-and-subscribe), reliability and security.

AMQP

To become the standard protocol for interoperability between all messaging

middleware

AMQP

PluginsManagement

• Gerenciamento• Configuração• Monitoramento

STOMP/ MQTT• Integrações utilizando outros protocolos de comunicação

Federation / Shovel• Configuração de cluster em redes não confiáveis

Características do RabbitMQ• Queue• Consumer

• Public/Subscriber• Exchange• Channel• Persitent

• Durável / Transiente• Atomicidade• Round-Robin• Acknolodge

• Ack/Nack• TTL (Time to Live)

Tipos de fila do RabbitMQ

• Basic• Work• Topic• Route• Fanout• RPC

Basic - RabbitMQ

P – ProducerC – ConsumerQueue in Red

The simplest thing that does something

Work - RabbitMQ

Distributing tasks among workers

Automatic - Round-Robin

Publish/Subscribe (FanOut)- RabbitMQ

Sending messages to many consumers at once

Exchange Types: direct, topic, headers and fanoutchannel.exchange_declare(exchange='direct_logs', type=‘fanout')

Routing - RabbitMQ

Receiving messages selectivelychannel.exchange_declare(exchange='direct_logs', type='direct')channel.basic_publish(exchange='direct_logs', routing_key=severity, body=message)

Topics - RabbitMQ

Receiving messages based on a patternchannel.exchange_declare(exchange='direct_logs',

type=‘topic')

RPC Async WorkFlow - RabbitMQ

Remote procedure call implementationDefine properties: CorrelationId and ReplyTo (QueueName to reply

message)

Install Client - RabbitMQ{ "require": { "php-amqplib/php-amqplib": "2.5.*" }}

$composer install or update

Tutorial: https://www.rabbitmq.com/tutorials/

API de Autorização{ Stack }

Repositório de código: https://github.com/alexandrebl

• NoSQL• Cache de dados• Dicionário (Chave/Valor)• Dados em memória• Persistência como opção• Stand Alone• Cluster• Replicação• Redis-cli• Redis Manager

• NoSQL• Json Format Data• Dados em disco• Stand Alone• Shard• Replica• Mongo Shell• RoboMongo• MongoChef

• PHP Framework• MVC• Open-source• REST API• Event/handle• Console• Composer

Fluxo da API de Autorização

{Seja hoje uma pessoa

melhor do que você foi ontem

}

Pesquise...

Pesquise...Estude...

Pesquise...Estude...

Domine...

Pesquise...Estude...

Influencie...

Domine...

Alexandre Brandão

Twitter: @abrandaolustosaE-mail: abrandao@mundipagg.comTel: +55 (21) 97367-6161

https://github.com/alexandrebl

Obrigado :)

Linkedin: abrandaol

Alexandre Brandão

Twitter: @abrandaolustosaE-mail: abrandao@mundipagg.comTel: +55 (21) 97367-6161

https://github.com/alexandrebl

Perguntas?

Linkedin: abrandaol