SlideShare a Scribd company logo
AWS PHP SDK v3
Asynchronous Requests
Michael Dowling
@mtdowling
AWS PHP SDK v3
Asynchronous Requests
Michael Dowling
@mtdowling
What we’ll cover
• Promises
• Handlers and Middleware
• ReactPHP in the SDK
• A promise represents the eventual result of an
asynchronous operation.
• Promises are values and are composable
https://promisesaplus.com/
Promises/A+
Promises
• A promise has a then() method, which allows
access to its current or eventual value or reason.
• Promises are resolved with a value or rejected
with a reason.
• State transitions: Pending -> (Fulfilled | Rejected)
• Fulfilled and rejected promises are immutable.
https://promisesaplus.com/
Promises
then()
• Calling then() on a promise will return a new promise
that is fulfilled or rejected based on the result of invoking
the provided then($onFullfilled,	
  $onRejected)
callbacks.
• If a callback throws, the promise is rejected and
downstream promises are rejected.
• If a rejected callback does not throw, downstream
promises are fulfilled.
• If a promise is fulfilled or rejected with a promise, any
callbacks registered on the promise will not be invoked
until the promise is resolved.
then()
Promises in the SDK
1.
2.
• Multiple promises can be composed together into a
single promise using combinators
• Guzzle ships with several combinators
Promise Combinators
Promise Combinator
Examples
all($promises)	
  //	
  usage
some($promises)	
  //	
  usage
any($promises)	
  //	
  usage
each_limit($iterable,	
  $concurrency,	
  …)
Promise Coroutines
SDK Pool
Handlers and Middleware
• A handler is a function that performs the actual
transformation of a command and request into
a result (e.g., Guzzle is a handler).
• A middleware is a higher-order function that
modifies a command, request, or result as it
passes through the middleware.
• A HandlerList is used by clients and
commands to compose middleware on a
handler.
Handlers
HandlerList
• A client has a HandlerList that contains a
handler and a list of middleware.
• Each command created by a client get a clone
of the client’s HandlerList that allows per/
command customizations.
HandlerList
• Request lifecycle in the HandlerList
init -> validate -> build -> sign
sign -> build -> validate -> init
execute
returns Promise<Result, Exception>
Command
Adding middleware to
HandlerList
Middleware
Anatomy of a middleware
Example: Validation middleware.
2)	
  Shared	
  state
3)	
  Return	
  a

composable

function
4)	
  Return	
  a

new	
  composed

handler
5)	
  Call	
  the

next	
  handler

and	
  return

a	
  promise
1)	
  Wrapping

function
Higher-order middleware
• Some handlers support async, some emulate.
• cURL handlers support async but must use
wait or you must tick the curl event loop
explicitly.
• Some handlers support async interop with
event loops…
Custom Handlers
Using a custom handler
• http_handler: works at the PSR-7 layer.



handler($request,	
  $options):	
  Promise<Response,	
  Error>
• handler: works at the SDK layer.



handler($command,	
  $request):	
  Promise<Result,	
  Error>
Using a custom handler
React Guzzle Handler
• The SDK supports Guzzle.
• Cees-Jan Kiewiet created a React Guzzle
handler.
• Therefore you can use React with the SDK!
composer	
  require	
  wyrihaximus/react-­‐guzzle-­‐psr7	
  
https://github.com/WyriHaximus/react-guzzle-psr7
Questions?

More Related Content

What's hot

Load Testing with Taurus using Jenkins and AWS
Load Testing with Taurus using Jenkins and AWSLoad Testing with Taurus using Jenkins and AWS
Load Testing with Taurus using Jenkins and AWS
Guy Salton
 
Introduction to Functional Reactive Programming
Introduction to Functional Reactive ProgrammingIntroduction to Functional Reactive Programming
Introduction to Functional Reactive Programming
Đặng Thái Sơn
 
Arquillian & Citrus
Arquillian & CitrusArquillian & Citrus
Arquillian & Citrus
christophd
 
Why I am hooked on the future of React
Why I am hooked on the future of ReactWhy I am hooked on the future of React
Why I am hooked on the future of React
Maurice De Beijer [MVP]
 
Salesforce DUG - Queueable Apex
Salesforce DUG - Queueable ApexSalesforce DUG - Queueable Apex
Salesforce DUG - Queueable Apex
Akshay Varu
 
Observer, a "real life" time series application
Observer, a "real life" time series applicationObserver, a "real life" time series application
Observer, a "real life" time series application
Kévin LOVATO
 
Batch Apex in Salesforce
Batch Apex in SalesforceBatch Apex in Salesforce
Batch Apex in Salesforce
David Helgerson
 
Batchable vs @future vs Queueable
Batchable vs @future vs QueueableBatchable vs @future vs Queueable
Batchable vs @future vs Queueable
Boris Bachovski
 
Boost your App with Gatling
Boost your App with GatlingBoost your App with Gatling
Boost your App with Gatling
Knoldus Inc.
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
Ramazan K
 
Load Balancing Algorithms - Which one to choose?
Load Balancing Algorithms - Which one to choose?Load Balancing Algorithms - Which one to choose?
Load Balancing Algorithms - Which one to choose?
Aditya Kamat
 
Deploying Rails Apps with Capistrano
Deploying Rails Apps with CapistranoDeploying Rails Apps with Capistrano
Deploying Rails Apps with Capistrano
Nyros Technologies
 

What's hot (12)

Load Testing with Taurus using Jenkins and AWS
Load Testing with Taurus using Jenkins and AWSLoad Testing with Taurus using Jenkins and AWS
Load Testing with Taurus using Jenkins and AWS
 
Introduction to Functional Reactive Programming
Introduction to Functional Reactive ProgrammingIntroduction to Functional Reactive Programming
Introduction to Functional Reactive Programming
 
Arquillian & Citrus
Arquillian & CitrusArquillian & Citrus
Arquillian & Citrus
 
Why I am hooked on the future of React
Why I am hooked on the future of ReactWhy I am hooked on the future of React
Why I am hooked on the future of React
 
Salesforce DUG - Queueable Apex
Salesforce DUG - Queueable ApexSalesforce DUG - Queueable Apex
Salesforce DUG - Queueable Apex
 
Observer, a "real life" time series application
Observer, a "real life" time series applicationObserver, a "real life" time series application
Observer, a "real life" time series application
 
Batch Apex in Salesforce
Batch Apex in SalesforceBatch Apex in Salesforce
Batch Apex in Salesforce
 
Batchable vs @future vs Queueable
Batchable vs @future vs QueueableBatchable vs @future vs Queueable
Batchable vs @future vs Queueable
 
Boost your App with Gatling
Boost your App with GatlingBoost your App with Gatling
Boost your App with Gatling
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
Load Balancing Algorithms - Which one to choose?
Load Balancing Algorithms - Which one to choose?Load Balancing Algorithms - Which one to choose?
Load Balancing Algorithms - Which one to choose?
 
Deploying Rails Apps with Capistrano
Deploying Rails Apps with CapistranoDeploying Rails Apps with Capistrano
Deploying Rails Apps with Capistrano
 

Similar to Php sdk-v3-async

Continuation_alan_20220503.pdf
Continuation_alan_20220503.pdfContinuation_alan_20220503.pdf
Continuation_alan_20220503.pdf
Shen yifeng
 
Angular js 1.0-fundamentals
Angular js 1.0-fundamentalsAngular js 1.0-fundamentals
Angular js 1.0-fundamentals
Venkatesh Narayanan
 
Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patt...
Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patt...Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patt...
Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patt...
Firmansyah, SCJP, OCEWCD, OCEWSD, TOGAF, OCMJEA, CEH
 
Getting Comfortable with JS Promises
Getting Comfortable with JS PromisesGetting Comfortable with JS Promises
Getting Comfortable with JS Promises
Asa Kusuma
 
Reactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaReactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-Java
Kasun Indrasiri
 
Angular js introduction
Angular js introductionAngular js introduction
Angular js introduction
Hsiu Shan
 
Client Drivers and Cassandra, the Right Way
Client Drivers and Cassandra, the Right WayClient Drivers and Cassandra, the Right Way
Client Drivers and Cassandra, the Right Way
DataStax Academy
 
Flux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from FlipkartFlux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from Flipkart
Shyam Kumar Akirala
 
Soa 31 jax ws server side development architecture
Soa 31 jax ws server side development architectureSoa 31 jax ws server side development architecture
Soa 31 jax ws server side development architecture
Vaibhav Khanna
 
Promises in JavaScript with jQuery
Promises in JavaScript with jQueryPromises in JavaScript with jQuery
Promises in JavaScript with jQuery
Ryan Blunden
 
Build and Manage Your APIs with Amazon API Gateway
Build and Manage Your APIs with Amazon API GatewayBuild and Manage Your APIs with Amazon API Gateway
Build and Manage Your APIs with Amazon API Gateway
Amazon Web Services
 
Reactive Java: Promises and Streams with Reakt (JavaOne Talk 2016)
Reactive Java:  Promises and Streams with Reakt (JavaOne Talk 2016)Reactive Java:  Promises and Streams with Reakt (JavaOne Talk 2016)
Reactive Java: Promises and Streams with Reakt (JavaOne Talk 2016)
Rick Hightower
 
Reactive Java: Promises and Streams with Reakt (JavaOne talk 2016)
Reactive Java: Promises and Streams with Reakt  (JavaOne talk 2016)Reactive Java: Promises and Streams with Reakt  (JavaOne talk 2016)
Reactive Java: Promises and Streams with Reakt (JavaOne talk 2016)
Rick Hightower
 
Architecting for Microservices Part 2
Architecting for Microservices Part 2Architecting for Microservices Part 2
Architecting for Microservices Part 2
Elana Krasner
 
Introduction to Varnish VCL
Introduction to Varnish VCLIntroduction to Varnish VCL
Introduction to Varnish VCLPax Dickinson
 
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Gal Marder
 
Grails services
Grails servicesGrails services
Grails services
NexThoughts Technologies
 
HBaseCon2017 Highly-Available HBase
HBaseCon2017 Highly-Available HBaseHBaseCon2017 Highly-Available HBase
HBaseCon2017 Highly-Available HBase
HBaseCon
 
Микросервисы со Spring Boot & Spring Cloud
Микросервисы со Spring Boot & Spring CloudМикросервисы со Spring Boot & Spring Cloud
Микросервисы со Spring Boot & Spring Cloud
Vitebsk DSC
 

Similar to Php sdk-v3-async (20)

Continuation_alan_20220503.pdf
Continuation_alan_20220503.pdfContinuation_alan_20220503.pdf
Continuation_alan_20220503.pdf
 
Angular js 1.0-fundamentals
Angular js 1.0-fundamentalsAngular js 1.0-fundamentals
Angular js 1.0-fundamentals
 
Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patt...
Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patt...Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patt...
Chapter 05: Eclipse Vert.x - Service Discovery, Resilience and Stability Patt...
 
Getting Comfortable with JS Promises
Getting Comfortable with JS PromisesGetting Comfortable with JS Promises
Getting Comfortable with JS Promises
 
Reactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-JavaReactive Programming in Java 8 with Rx-Java
Reactive Programming in Java 8 with Rx-Java
 
Angular js introduction
Angular js introductionAngular js introduction
Angular js introduction
 
Client Drivers and Cassandra, the Right Way
Client Drivers and Cassandra, the Right WayClient Drivers and Cassandra, the Right Way
Client Drivers and Cassandra, the Right Way
 
Flux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from FlipkartFlux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from Flipkart
 
Soa 31 jax ws server side development architecture
Soa 31 jax ws server side development architectureSoa 31 jax ws server side development architecture
Soa 31 jax ws server side development architecture
 
Promises in JavaScript with jQuery
Promises in JavaScript with jQueryPromises in JavaScript with jQuery
Promises in JavaScript with jQuery
 
Build and Manage Your APIs with Amazon API Gateway
Build and Manage Your APIs with Amazon API GatewayBuild and Manage Your APIs with Amazon API Gateway
Build and Manage Your APIs with Amazon API Gateway
 
Making the most out of CakePHP 2.2
Making the most out of CakePHP 2.2Making the most out of CakePHP 2.2
Making the most out of CakePHP 2.2
 
Reactive Java: Promises and Streams with Reakt (JavaOne Talk 2016)
Reactive Java:  Promises and Streams with Reakt (JavaOne Talk 2016)Reactive Java:  Promises and Streams with Reakt (JavaOne Talk 2016)
Reactive Java: Promises and Streams with Reakt (JavaOne Talk 2016)
 
Reactive Java: Promises and Streams with Reakt (JavaOne talk 2016)
Reactive Java: Promises and Streams with Reakt  (JavaOne talk 2016)Reactive Java: Promises and Streams with Reakt  (JavaOne talk 2016)
Reactive Java: Promises and Streams with Reakt (JavaOne talk 2016)
 
Architecting for Microservices Part 2
Architecting for Microservices Part 2Architecting for Microservices Part 2
Architecting for Microservices Part 2
 
Introduction to Varnish VCL
Introduction to Varnish VCLIntroduction to Varnish VCL
Introduction to Varnish VCL
 
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
 
Grails services
Grails servicesGrails services
Grails services
 
HBaseCon2017 Highly-Available HBase
HBaseCon2017 Highly-Available HBaseHBaseCon2017 Highly-Available HBase
HBaseCon2017 Highly-Available HBase
 
Микросервисы со Spring Boot & Spring Cloud
Микросервисы со Spring Boot & Spring CloudМикросервисы со Spring Boot & Spring Cloud
Микросервисы со Spring Boot & Spring Cloud
 

Recently uploaded

Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 

Recently uploaded (20)

Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 

Php sdk-v3-async

  • 1. AWS PHP SDK v3 Asynchronous Requests Michael Dowling @mtdowling
  • 2. AWS PHP SDK v3 Asynchronous Requests Michael Dowling @mtdowling
  • 3. What we’ll cover • Promises • Handlers and Middleware • ReactPHP in the SDK
  • 4. • A promise represents the eventual result of an asynchronous operation. • Promises are values and are composable https://promisesaplus.com/ Promises/A+
  • 5. Promises • A promise has a then() method, which allows access to its current or eventual value or reason. • Promises are resolved with a value or rejected with a reason. • State transitions: Pending -> (Fulfilled | Rejected) • Fulfilled and rejected promises are immutable. https://promisesaplus.com/
  • 7. then() • Calling then() on a promise will return a new promise that is fulfilled or rejected based on the result of invoking the provided then($onFullfilled,  $onRejected) callbacks. • If a callback throws, the promise is rejected and downstream promises are rejected. • If a rejected callback does not throw, downstream promises are fulfilled. • If a promise is fulfilled or rejected with a promise, any callbacks registered on the promise will not be invoked until the promise is resolved.
  • 9. Promises in the SDK 1. 2.
  • 10. • Multiple promises can be composed together into a single promise using combinators • Guzzle ships with several combinators Promise Combinators
  • 18. Handlers and Middleware • A handler is a function that performs the actual transformation of a command and request into a result (e.g., Guzzle is a handler). • A middleware is a higher-order function that modifies a command, request, or result as it passes through the middleware. • A HandlerList is used by clients and commands to compose middleware on a handler.
  • 20. HandlerList • A client has a HandlerList that contains a handler and a list of middleware. • Each command created by a client get a clone of the client’s HandlerList that allows per/ command customizations.
  • 21. HandlerList • Request lifecycle in the HandlerList init -> validate -> build -> sign sign -> build -> validate -> init execute returns Promise<Result, Exception> Command
  • 24. Anatomy of a middleware Example: Validation middleware. 2)  Shared  state 3)  Return  a
 composable
 function 4)  Return  a
 new  composed
 handler 5)  Call  the
 next  handler
 and  return
 a  promise 1)  Wrapping
 function
  • 26. • Some handlers support async, some emulate. • cURL handlers support async but must use wait or you must tick the curl event loop explicitly. • Some handlers support async interop with event loops… Custom Handlers
  • 27. Using a custom handler • http_handler: works at the PSR-7 layer.
 
 handler($request,  $options):  Promise<Response,  Error> • handler: works at the SDK layer.
 
 handler($command,  $request):  Promise<Result,  Error>
  • 28. Using a custom handler
  • 29. React Guzzle Handler • The SDK supports Guzzle. • Cees-Jan Kiewiet created a React Guzzle handler. • Therefore you can use React with the SDK! composer  require  wyrihaximus/react-­‐guzzle-­‐psr7   https://github.com/WyriHaximus/react-guzzle-psr7