php and asynchronous systems

24
Magento PHP and Asynchronous Communication

Upload: vrann-tulika

Post on 31-May-2015

413 views

Category:

Technology


1 download

DESCRIPTION

MageConf3 presentation

TRANSCRIPT

Page 1: PHP and Asynchronous Systems

Magento

PHP and Asynchronous Communication

Page 2: PHP and Asynchronous Systems

Magento

About myself

Eugene Tulika Magento Expert Consulting Group

Senior Developer / Team Lead

Page 3: PHP and Asynchronous Systems

Magento

PHP in a Rocket Science Agile Time To Market

It’s a language to "solve the web problem"

Enterprise Open Source PHP Frontend / Java Backend

Page 4: PHP and Asynchronous Systems

Magento

PHP

PHP

Page 5: PHP and Asynchronous Systems

Magento

Asynchrony

Page 6: PHP and Asynchronous Systems

Magento

Asynchrony in PHP

Save User information

Send e-mail “User is created”

Save Shipping information

Save Order Information

Send e-mail “Order is created”

Page 7: PHP and Asynchronous Systems

Magento

Mail ServiceFront Server

Asynchrony in PHP

Save User information Send e-mail

“User is created”Save Shipping

information

Save Order Information Send e-mail

“Order is created”

UI

Page 8: PHP and Asynchronous Systems

Magento

Asynchrony Architecture

Page 9: PHP and Asynchronous Systems

Magento

Front Server

Asynchrony in PHP

Users Server

Shipment Server

Sales Server

Page 10: PHP and Asynchronous Systems

Magento

Messages and Channels

Page 11: PHP and Asynchronous Systems

Magento

Messages and Channels

Page 12: PHP and Asynchronous Systems

Magento

Message Queue Concept

Messages arrived to Channel

NotifyEvent-Driven

Consumer

Poll Polling Consumer

Competing Consumers

Page 13: PHP and Asynchronous Systems

Magento

Message Queue on PHP Based on Tables

Shared Database

ConsumerNode#2

ConsumerNode#3

ConsumerNode#1cron

cron

cron

EndpointController

Java ESB

Page 14: PHP and Asynchronous Systems

Magento

Publish/Subscribe

Publisher

Subscriber 1

Subscriber 2

Subscriber 3

Channel

Channel

Channel

Channel

Page 15: PHP and Asynchronous Systems

Magento

Response is Needed

Page 16: PHP and Asynchronous Systems

Magento

Request-Reply Pattern

Page 17: PHP and Asynchronous Systems

Magento

Synchronous blocking on PHP

PHP application

Request Channel

Reply Channel

Sync Bridge

Page 18: PHP and Asynchronous Systems

Magento

Synchronous blocking on PHP

Requestor

Mes

sage

cha

nnel

Persisted Messages

Receiver (controller)

Page 19: PHP and Asynchronous Systems

Magento

Request/Response Tables

Request Id Request Data

1 {“Color”:”P!nk”}

Response ID Request ID Response Data

1 Null

2 1 {“Color”:”P!nk”,“Saved”:”true”}

Page 20: PHP and Asynchronous Systems

Magento

Your request is being proceeded

Page 21: PHP and Asynchronous Systems

Magento

Asynchronous callback on PHP

Requestor

Mes

sage

cha

nnel

Receiver /controller/

CallbackDB

PHP application

Update

Messaging LayerBusiness Logic

Page 22: PHP and Asynchronous Systems

Magento

UI changes

Page 23: PHP and Asynchronous Systems

Magento

Testing with Stubs