SlideShare une entreprise Scribd logo
1  sur  45
Télécharger pour lire hors ligne
SOA with
Zend Framework
      By Mike Willbanks
 Software Engineering Manager
         CaringBridge
About Mike…


    • Software Engineering Manager at CaringBridge
    • Open Source Contributor
    • Organizer of MNPHP


    • Where you can find me:
      Twitter: mwillbanks

      G+: Mike Willbanks

      IRC (freenode): lubs

      Blog: http://blog.digitalstruct.com



2
The Back Story
Definitions
SOA In Other Words
A Question to Consider
Definitions


    • SOA – Service-Oriented Architecture
      A set of principles and methodologies for designing and developing
       software.
      A structure for delivering content through services.
        • Think of a service consumer attaching to your web service; it likely is
          not using a database.

    • Service
      A set of related software functionalities that can be reused for
       different purposes.
      Essentially; the encompassed business functionality divided into
       tasks that streamline the interface and remove the spaghetti.


4
A Question to Consider


    • How often have you thought about not only how your code
      can serve others but how it can service you, your team
      along side of supporting external parties?
      Think core site.

      Think mobile.

      Think public.




5
What I mean by that…


    • Slight adjustments when not using a service based model
      has a larger scale of changes throughout your app.
    • Adding caching or logging can be more difficult.
    • Your entity was split into multiple tables but you utilized a
      Zend_Db_Table for the model class. It is going to be a
      larger change.
    • Business Process in the Controller; forces implementation
      into the additional products and if it changes has down
      stream expense.




6
Make it stop!




7
Zend Framework and SOA
Service Layer
Decorating Models
Attaching the Servers
Service Layer
One of the most important things when building a SOA layer
is going to be the underlying services; these services are
enabled by the architecture of your models.
Aspects of a Service Layer




10
A Service


     • Satisfies a Business function
       Function broken into Tasks

     • Easy consumption by your application
     • Allows vast re-use and more generic implementations
     • Decoupled to represent more or less a single item
     • Application logic becomes more encompassed
       Filtering

       Validation

       Transactions / Interactions between Domain Models



11
Example Service




12
Domain Models


     • A domain model is a representative entity of “something”
       that solves a domain problem.
     • The entity is NOT explicitly tied to your database.
     • The entity essentially contains getters and setters for
       properties and potentially some behaviors.




13
Example Domain Model




14
Data Mapper


     • A data mapper handles the communication between the
       data source and the population of an domain model.
       In a ZF context this is generally fetching data from
        Zend_Db_Table.
     • Extremely flexible and easily handles if the underlying data
       changes.
       Alternatively; when you now have separate tables that still can
        represent the same domain model.




15
Example Data Mapper




16
Data Store


     • Persistence… you need to store it somewhere!
     • Data may come from several places…
       File System

       Web Service

       NoSQL DB

       Relational DB

     • If you utilize an ORM this is also where it would live.




17
Data Store Example




18
Decoration
Caching
Logging
Formatting
Decorators?


     • Let’s face it… decorators do a better job decorating than we
       do ourselves.




20
Decorators


     • Decorators allow you to add new behaviors to an existing
       object dynamically…
       Remember the previous examples? We used a few interfaces and
        now you will see why.
     • General Use Cases
       Performance is becoming more of a concern and you need to
        implement caching.
       An object is coming back with unexpected data at times; so you
        need to be able to log what was coming through.
       You need to represent an object differently such as JSON, XML,
        Serialized PHP, etc.


21
Implementing Caching




22
Implementing Logging




23
Changing the Format




24
Just Decoration?


     • Remember decoration is just a pattern; it can help you do
       several things but it cannot do everything!
     • Don’t be afraid to utilize other patterns to assist you in the
       build out of your models.
     • The ultimate goal here is to remove the constant cost of
       refactoring for every feature change.




25
Attaching the Servers
Zend_Json_Server
Zend_XmlRpc_Server
Zend_Soap_Server
Zend_Rest_Server
The Server Components


     • All of the server components act approximately the same in
       terms of their API.
     • Each of them follow the same paradigm allowing you to
       connect them directly to a service object.
       That means… this is going to be easy!

     • However, the server components utilize Reflection for
       AutoDiscovery as well as to understand the actual call.




27
So, docblocks are always good!




28
Implementing Servers through Controllers


     • Why use controllers?
       Because they are already there and it fits directly into how you
        made your controller in the first place.
       You can leverage your existing code to add them in.

       Providing only a new action makes this possible.

       Easily discoverable just by the URI.

     • In our examples – we are going to leverage an API action




29
Putting in an API method with Zend_Json_Server




30
It really is just that “easy”


     • We just implemented a JSON RPC server, wasn’t that easy?
     • You now have methods that you can call through a JSON
       RPC client based right off of your service object.


     • We did skip out on something, isn’t there a discoverability
       component?




31
Adding Discovery




32
The Community Wants More


     • The API is now exposed, people are using it but you are
       getting requests for additional protocols
       Where is the SOAP API?

       How come there is no XML RPC API?

       Everyone uses more REST based API’s, WTF?

     • Time to implement some more!
       For now, we will implement this using a type variable.




33
Multiple Servers – One API.




34
So What About those Formatters?


     • Previously in our decoration; I showed you how to change
       the output by decoration.
     • While they can be useful sometimes; Context Switching
       handles much of this for you already.
       So it was really just an example but may become relevant
        elsewhere.




35
Example Context Switch




36
Versioning
A couple options to help version your services.
Versioning Services


     • There are a few different ways to version services; we know
       things will change and we need a way to support BC.
     • Versioning is important and can be implemented several
       ways.
     • They are not “perfect” but can and will work.




38
Versioning by Directory


     • Make version directories in your models directory
       Pros
         • Quick to implement
         • Individual services take on a new version
       Cons
         • Not all services take on the same version number; more confusing to
           the consumer of the service.
         • You need to push a version parameter to your api action
         • You would end up implementing fallbacks based on versions not
           existing.




39
Versioning by Module


     • Make version modules
       Pros
        • Separation of entire service into a new module
        • All services take on a new version.
        • Simply extend the previous models.
       Cons
        • Latest service would always be contained in a globals model folder to
          prevent code duplication;
        • Many more files; not easy to simply see what is new and what is not.
        • Modules work for this but; only really work if your entire api is a
          module and the other application is not. Which removes part of our
          reuse.

40
Other Notes
Things worth mentioning…
Consumer Performance


     • Planning for consumer performance is important for
       instance:
       Setting a reasonable timeout on the client end.

       Messaging the user if it did timeout or some other issue occurred.

       Utilizing some form of caching between the service and you
        (something like a squid proxy) to help boost the requests per
        second.
       Implementing local caching and keeping track of things for that
        user.
       Utilize parallelism; if you need to grab multiple things do them at
        one time.
       Parsing is expensive; do it one and pass it around.

42
Who are you?


     • When implementing web services; there are a few
       additional things to think about
       Rate Limiting
        • Implemented more or less in a plug-in.
       Authentication
        • Leveraging tokens or API keys.
           – A token service can deal with authentication and even allow them to have
             sessions through the service layer.

       Authorization
        • Extending the server components to be aware of resources.
           – This is harder but gives fine grained control.
        • Otherwise, if you allow to a service they can access the entire service.

43
Zend Framework 2


     • How will this all work in ZF2?
       Well; I’m not fully sure but there is an RFC!
         • http://framework.zend.com/wiki/display/ZFDEV2/RFC+-
           +Server+Classes
       All I can say; is it will be better with the new EventManager
         • Authorization will become easier.
         • Plugging in will be entirely more flexible.




44
Questions?
Give me feedback: http://joind.in/3784
Slides will be posted at joind.in later this afternoon.

Contenu connexe

Tendances

The Dual write problem
The Dual write problemThe Dual write problem
The Dual write problemJeppe Cramon
 
CQRS and event sourcing
CQRS and event sourcingCQRS and event sourcing
CQRS and event sourcingJeppe Cramon
 
Advanced O/R Mapping with Glorp
Advanced O/R Mapping with GlorpAdvanced O/R Mapping with Glorp
Advanced O/R Mapping with GlorpESUG
 
From ActiveRecord to EventSourcing
From ActiveRecord to EventSourcingFrom ActiveRecord to EventSourcing
From ActiveRecord to EventSourcingEmanuele DelBono
 
Cooking your Ravioli "al dente" with Hexagonal Architecture
Cooking your Ravioli "al dente" with Hexagonal ArchitectureCooking your Ravioli "al dente" with Hexagonal Architecture
Cooking your Ravioli "al dente" with Hexagonal ArchitectureJeroen Rosenberg
 

Tendances (6)

The Dual write problem
The Dual write problemThe Dual write problem
The Dual write problem
 
CQRS and event sourcing
CQRS and event sourcingCQRS and event sourcing
CQRS and event sourcing
 
Advanced O/R Mapping with Glorp
Advanced O/R Mapping with GlorpAdvanced O/R Mapping with Glorp
Advanced O/R Mapping with Glorp
 
From ActiveRecord to EventSourcing
From ActiveRecord to EventSourcingFrom ActiveRecord to EventSourcing
From ActiveRecord to EventSourcing
 
Cooking your Ravioli "al dente" with Hexagonal Architecture
Cooking your Ravioli "al dente" with Hexagonal ArchitectureCooking your Ravioli "al dente" with Hexagonal Architecture
Cooking your Ravioli "al dente" with Hexagonal Architecture
 
The CQRS diet
The CQRS dietThe CQRS diet
The CQRS diet
 

En vedette

How to-choose-the-right-technology-architecture-for-your-mobile-application
How to-choose-the-right-technology-architecture-for-your-mobile-applicationHow to-choose-the-right-technology-architecture-for-your-mobile-application
How to-choose-the-right-technology-architecture-for-your-mobile-applicationlverb
 
Delivering HTML5 and Modern Apps
Delivering HTML5 and Modern AppsDelivering HTML5 and Modern Apps
Delivering HTML5 and Modern AppsJoshua Drew
 
Top 10 HTML5 frameworks for effective development in 2016
Top 10 HTML5 frameworks for effective development in 2016Top 10 HTML5 frameworks for effective development in 2016
Top 10 HTML5 frameworks for effective development in 2016iMOBDEV Technologies Pvt. Ltd.
 
Building modern web apps with html5, javascript, and java
Building modern web apps with html5, javascript, and javaBuilding modern web apps with html5, javascript, and java
Building modern web apps with html5, javascript, and javaAlexander Gyoshev
 
Modern Web App Architectures
Modern Web App ArchitecturesModern Web App Architectures
Modern Web App ArchitecturesRaphael Stary
 
Web Development Technologies
Web Development TechnologiesWeb Development Technologies
Web Development TechnologiesVignesh Prajapati
 
Structuring web applications with Backbone.js
Structuring web applications with Backbone.jsStructuring web applications with Backbone.js
Structuring web applications with Backbone.jsDiego Cardozo
 
Writing HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAEWriting HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAERon Reiter
 
Introduction To Building Enterprise Web Application With Spring Mvc
Introduction To Building Enterprise Web Application With Spring MvcIntroduction To Building Enterprise Web Application With Spring Mvc
Introduction To Building Enterprise Web Application With Spring MvcAbdelmonaim Remani
 
Quick Application Development with Web Frameworks
Quick Application Development with Web FrameworksQuick Application Development with Web Frameworks
Quick Application Development with Web FrameworksStratepedia Presentations
 
A Simpler Web App Architecture (jDays 2016)
A Simpler Web App Architecture (jDays 2016)A Simpler Web App Architecture (jDays 2016)
A Simpler Web App Architecture (jDays 2016)Gustaf Nilsson Kotte
 
Web Application Frameworks - Web Technologies (1019888BNR)
Web Application Frameworks - Web Technologies (1019888BNR)Web Application Frameworks - Web Technologies (1019888BNR)
Web Application Frameworks - Web Technologies (1019888BNR)Beat Signer
 
Intro to modern web technology
Intro to modern web technologyIntro to modern web technology
Intro to modern web technologyChris Love
 
Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot Evan Lin
 
Web Application Development
Web Application DevelopmentWeb Application Development
Web Application DevelopmentWhytespace Ltd.
 
Architecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web AppsArchitecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web AppsRasheed Waraich
 
SOA with PHP and Symfony
SOA with PHP and SymfonySOA with PHP and Symfony
SOA with PHP and SymfonyMichalSchroeder
 

En vedette (20)

How to-choose-the-right-technology-architecture-for-your-mobile-application
How to-choose-the-right-technology-architecture-for-your-mobile-applicationHow to-choose-the-right-technology-architecture-for-your-mobile-application
How to-choose-the-right-technology-architecture-for-your-mobile-application
 
Delivering HTML5 and Modern Apps
Delivering HTML5 and Modern AppsDelivering HTML5 and Modern Apps
Delivering HTML5 and Modern Apps
 
Top 10 HTML5 frameworks for effective development in 2016
Top 10 HTML5 frameworks for effective development in 2016Top 10 HTML5 frameworks for effective development in 2016
Top 10 HTML5 frameworks for effective development in 2016
 
Building modern web apps with html5, javascript, and java
Building modern web apps with html5, javascript, and javaBuilding modern web apps with html5, javascript, and java
Building modern web apps with html5, javascript, and java
 
Modern Web App Architectures
Modern Web App ArchitecturesModern Web App Architectures
Modern Web App Architectures
 
Web app architecture
Web app architectureWeb app architecture
Web app architecture
 
Web Development Technologies
Web Development TechnologiesWeb Development Technologies
Web Development Technologies
 
Structuring web applications with Backbone.js
Structuring web applications with Backbone.jsStructuring web applications with Backbone.js
Structuring web applications with Backbone.js
 
Writing HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAEWriting HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAE
 
Introduction To Building Enterprise Web Application With Spring Mvc
Introduction To Building Enterprise Web Application With Spring MvcIntroduction To Building Enterprise Web Application With Spring Mvc
Introduction To Building Enterprise Web Application With Spring Mvc
 
Ning presentation
Ning presentationNing presentation
Ning presentation
 
Quick Application Development with Web Frameworks
Quick Application Development with Web FrameworksQuick Application Development with Web Frameworks
Quick Application Development with Web Frameworks
 
Top 10 web application development frameworks 2016
Top 10 web application development frameworks 2016Top 10 web application development frameworks 2016
Top 10 web application development frameworks 2016
 
A Simpler Web App Architecture (jDays 2016)
A Simpler Web App Architecture (jDays 2016)A Simpler Web App Architecture (jDays 2016)
A Simpler Web App Architecture (jDays 2016)
 
Web Application Frameworks - Web Technologies (1019888BNR)
Web Application Frameworks - Web Technologies (1019888BNR)Web Application Frameworks - Web Technologies (1019888BNR)
Web Application Frameworks - Web Technologies (1019888BNR)
 
Intro to modern web technology
Intro to modern web technologyIntro to modern web technology
Intro to modern web technology
 
Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot
 
Web Application Development
Web Application DevelopmentWeb Application Development
Web Application Development
 
Architecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web AppsArchitecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web Apps
 
SOA with PHP and Symfony
SOA with PHP and SymfonySOA with PHP and Symfony
SOA with PHP and Symfony
 

Similaire à SOA with Zend Framework

Serverless Computing Model
Serverless Computing ModelServerless Computing Model
Serverless Computing ModelMohamed Samir
 
Developing modular Java applications
Developing modular Java applicationsDeveloping modular Java applications
Developing modular Java applicationsJulien Dubois
 
The Need of Cloud-Native Application
The Need of Cloud-Native ApplicationThe Need of Cloud-Native Application
The Need of Cloud-Native ApplicationEmiliano Pecis
 
Cloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a CacheCloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a Cachecornelia davis
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to MicroservicesMahmoudZidan41
 
When small problems become big problems
When small problems become big problemsWhen small problems become big problems
When small problems become big problemsAdrian Cole
 
Microservice Architecture Patterns, by Richard Langlois P. Eng.
Microservice Architecture Patterns, by Richard Langlois P. Eng.Microservice Architecture Patterns, by Richard Langlois P. Eng.
Microservice Architecture Patterns, by Richard Langlois P. Eng.Richard Langlois P. Eng.
 
Containers, microservices and serverless for realists
Containers, microservices and serverless for realistsContainers, microservices and serverless for realists
Containers, microservices and serverless for realistsKarthik Gaekwad
 
Software Architecture and Architectors: useless VS valuable
Software Architecture and Architectors: useless VS valuableSoftware Architecture and Architectors: useless VS valuable
Software Architecture and Architectors: useless VS valuableComsysto Reply GmbH
 
Architectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and ConsistentlyArchitectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and ConsistentlyComsysto Reply GmbH
 
Architectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and ConsistentlyArchitectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and ConsistentlyComsysto Reply GmbH
 
Cloud-Native-Data with Cornelia Davis
Cloud-Native-Data with Cornelia DavisCloud-Native-Data with Cornelia Davis
Cloud-Native-Data with Cornelia DavisVMware Tanzu
 
QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes Abdul Basit Munda
 
Headless cms architecture
Headless cms architectureHeadless cms architecture
Headless cms architectureKevin Wenger
 
Microservices: The Best Practices
Microservices: The Best PracticesMicroservices: The Best Practices
Microservices: The Best PracticesPavel Mička
 
Is your ABAP Code Ready for the Cloud?
Is your ABAP Code Ready for the Cloud?Is your ABAP Code Ready for the Cloud?
Is your ABAP Code Ready for the Cloud?Tobias Trapp
 
Microservices, Spring Cloud & Cloud Foundry
Microservices, Spring Cloud & Cloud FoundryMicroservices, Spring Cloud & Cloud Foundry
Microservices, Spring Cloud & Cloud FoundryEmilio Garcia
 
#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?Tammy Bednar
 

Similaire à SOA with Zend Framework (20)

Grails Services
Grails ServicesGrails Services
Grails Services
 
Serverless Computing Model
Serverless Computing ModelServerless Computing Model
Serverless Computing Model
 
Developing modular Java applications
Developing modular Java applicationsDeveloping modular Java applications
Developing modular Java applications
 
The Need of Cloud-Native Application
The Need of Cloud-Native ApplicationThe Need of Cloud-Native Application
The Need of Cloud-Native Application
 
Cloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a CacheCloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a Cache
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
When small problems become big problems
When small problems become big problemsWhen small problems become big problems
When small problems become big problems
 
Microservice Architecture Patterns, by Richard Langlois P. Eng.
Microservice Architecture Patterns, by Richard Langlois P. Eng.Microservice Architecture Patterns, by Richard Langlois P. Eng.
Microservice Architecture Patterns, by Richard Langlois P. Eng.
 
Containers, microservices and serverless for realists
Containers, microservices and serverless for realistsContainers, microservices and serverless for realists
Containers, microservices and serverless for realists
 
Software Architecture and Architectors: useless VS valuable
Software Architecture and Architectors: useless VS valuableSoftware Architecture and Architectors: useless VS valuable
Software Architecture and Architectors: useless VS valuable
 
Architectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and ConsistentlyArchitectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and Consistently
 
Architectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and ConsistentlyArchitectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and Consistently
 
Cloud-native Data
Cloud-native DataCloud-native Data
Cloud-native Data
 
Cloud-Native-Data with Cornelia Davis
Cloud-Native-Data with Cornelia DavisCloud-Native-Data with Cornelia Davis
Cloud-Native-Data with Cornelia Davis
 
QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes
 
Headless cms architecture
Headless cms architectureHeadless cms architecture
Headless cms architecture
 
Microservices: The Best Practices
Microservices: The Best PracticesMicroservices: The Best Practices
Microservices: The Best Practices
 
Is your ABAP Code Ready for the Cloud?
Is your ABAP Code Ready for the Cloud?Is your ABAP Code Ready for the Cloud?
Is your ABAP Code Ready for the Cloud?
 
Microservices, Spring Cloud & Cloud Foundry
Microservices, Spring Cloud & Cloud FoundryMicroservices, Spring Cloud & Cloud Foundry
Microservices, Spring Cloud & Cloud Foundry
 
#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?
 

Plus de Mike Willbanks

2015 ZendCon - Do you queue
2015 ZendCon - Do you queue2015 ZendCon - Do you queue
2015 ZendCon - Do you queueMike Willbanks
 
ZF2: Writing Service Components
ZF2: Writing Service ComponentsZF2: Writing Service Components
ZF2: Writing Service ComponentsMike Willbanks
 
Writing Services with ZF2
Writing Services with ZF2Writing Services with ZF2
Writing Services with ZF2Mike Willbanks
 
Varnish Cache - International PHP Conference Fall 2012
Varnish Cache - International PHP Conference Fall 2012Varnish Cache - International PHP Conference Fall 2012
Varnish Cache - International PHP Conference Fall 2012Mike Willbanks
 
Message Queues : A Primer - International PHP Conference Fall 2012
Message Queues : A Primer - International PHP Conference Fall 2012Message Queues : A Primer - International PHP Conference Fall 2012
Message Queues : A Primer - International PHP Conference Fall 2012Mike Willbanks
 
Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)Mike Willbanks
 
Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Mike Willbanks
 
Varnish, The Good, The Awesome, and the Downright Crazy.
Varnish, The Good, The Awesome, and the Downright Crazy.Varnish, The Good, The Awesome, and the Downright Crazy.
Varnish, The Good, The Awesome, and the Downright Crazy.Mike Willbanks
 
Leveraging Zend Framework for Sending Push Notifications
Leveraging Zend Framework for Sending Push NotificationsLeveraging Zend Framework for Sending Push Notifications
Leveraging Zend Framework for Sending Push NotificationsMike Willbanks
 
Gearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleGearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleMike Willbanks
 
Varnish, The Good, The Awesome, and the Downright Crazy
Varnish, The Good, The Awesome, and the Downright CrazyVarnish, The Good, The Awesome, and the Downright Crazy
Varnish, The Good, The Awesome, and the Downright CrazyMike Willbanks
 
Zend Framework Push Notifications
Zend Framework Push NotificationsZend Framework Push Notifications
Zend Framework Push NotificationsMike Willbanks
 
Mobile Push Notifications
Mobile Push NotificationsMobile Push Notifications
Mobile Push NotificationsMike Willbanks
 
MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011Mike Willbanks
 
The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKXMike Willbanks
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101Mike Willbanks
 
The Art of Message Queues
The Art of Message QueuesThe Art of Message Queues
The Art of Message QueuesMike Willbanks
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database DeploymentsMike Willbanks
 

Plus de Mike Willbanks (20)

2015 ZendCon - Do you queue
2015 ZendCon - Do you queue2015 ZendCon - Do you queue
2015 ZendCon - Do you queue
 
ZF2: Writing Service Components
ZF2: Writing Service ComponentsZF2: Writing Service Components
ZF2: Writing Service Components
 
Writing Services with ZF2
Writing Services with ZF2Writing Services with ZF2
Writing Services with ZF2
 
Varnish Cache - International PHP Conference Fall 2012
Varnish Cache - International PHP Conference Fall 2012Varnish Cache - International PHP Conference Fall 2012
Varnish Cache - International PHP Conference Fall 2012
 
Message Queues : A Primer - International PHP Conference Fall 2012
Message Queues : A Primer - International PHP Conference Fall 2012Message Queues : A Primer - International PHP Conference Fall 2012
Message Queues : A Primer - International PHP Conference Fall 2012
 
Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)
 
Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012
 
Varnish Cache
Varnish CacheVarnish Cache
Varnish Cache
 
Varnish, The Good, The Awesome, and the Downright Crazy.
Varnish, The Good, The Awesome, and the Downright Crazy.Varnish, The Good, The Awesome, and the Downright Crazy.
Varnish, The Good, The Awesome, and the Downright Crazy.
 
Leveraging Zend Framework for Sending Push Notifications
Leveraging Zend Framework for Sending Push NotificationsLeveraging Zend Framework for Sending Push Notifications
Leveraging Zend Framework for Sending Push Notifications
 
Gearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleGearman: A Job Server made for Scale
Gearman: A Job Server made for Scale
 
Varnish, The Good, The Awesome, and the Downright Crazy
Varnish, The Good, The Awesome, and the Downright CrazyVarnish, The Good, The Awesome, and the Downright Crazy
Varnish, The Good, The Awesome, and the Downright Crazy
 
Zend Framework Push Notifications
Zend Framework Push NotificationsZend Framework Push Notifications
Zend Framework Push Notifications
 
Mobile Push Notifications
Mobile Push NotificationsMobile Push Notifications
Mobile Push Notifications
 
MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011
 
The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKX
 
Art Of Message Queues
Art Of Message QueuesArt Of Message Queues
Art Of Message Queues
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101
 
The Art of Message Queues
The Art of Message QueuesThe Art of Message Queues
The Art of Message Queues
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
 

Dernier

The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Dernier (20)

The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

SOA with Zend Framework

  • 1. SOA with Zend Framework By Mike Willbanks Software Engineering Manager CaringBridge
  • 2. About Mike… • Software Engineering Manager at CaringBridge • Open Source Contributor • Organizer of MNPHP • Where you can find me:  Twitter: mwillbanks  G+: Mike Willbanks  IRC (freenode): lubs  Blog: http://blog.digitalstruct.com 2
  • 3. The Back Story Definitions SOA In Other Words A Question to Consider
  • 4. Definitions • SOA – Service-Oriented Architecture  A set of principles and methodologies for designing and developing software.  A structure for delivering content through services. • Think of a service consumer attaching to your web service; it likely is not using a database. • Service  A set of related software functionalities that can be reused for different purposes.  Essentially; the encompassed business functionality divided into tasks that streamline the interface and remove the spaghetti. 4
  • 5. A Question to Consider • How often have you thought about not only how your code can serve others but how it can service you, your team along side of supporting external parties?  Think core site.  Think mobile.  Think public. 5
  • 6. What I mean by that… • Slight adjustments when not using a service based model has a larger scale of changes throughout your app. • Adding caching or logging can be more difficult. • Your entity was split into multiple tables but you utilized a Zend_Db_Table for the model class. It is going to be a larger change. • Business Process in the Controller; forces implementation into the additional products and if it changes has down stream expense. 6
  • 8. Zend Framework and SOA Service Layer Decorating Models Attaching the Servers
  • 9. Service Layer One of the most important things when building a SOA layer is going to be the underlying services; these services are enabled by the architecture of your models.
  • 10. Aspects of a Service Layer 10
  • 11. A Service • Satisfies a Business function  Function broken into Tasks • Easy consumption by your application • Allows vast re-use and more generic implementations • Decoupled to represent more or less a single item • Application logic becomes more encompassed  Filtering  Validation  Transactions / Interactions between Domain Models 11
  • 13. Domain Models • A domain model is a representative entity of “something” that solves a domain problem. • The entity is NOT explicitly tied to your database. • The entity essentially contains getters and setters for properties and potentially some behaviors. 13
  • 15. Data Mapper • A data mapper handles the communication between the data source and the population of an domain model.  In a ZF context this is generally fetching data from Zend_Db_Table. • Extremely flexible and easily handles if the underlying data changes.  Alternatively; when you now have separate tables that still can represent the same domain model. 15
  • 17. Data Store • Persistence… you need to store it somewhere! • Data may come from several places…  File System  Web Service  NoSQL DB  Relational DB • If you utilize an ORM this is also where it would live. 17
  • 20. Decorators? • Let’s face it… decorators do a better job decorating than we do ourselves. 20
  • 21. Decorators • Decorators allow you to add new behaviors to an existing object dynamically…  Remember the previous examples? We used a few interfaces and now you will see why. • General Use Cases  Performance is becoming more of a concern and you need to implement caching.  An object is coming back with unexpected data at times; so you need to be able to log what was coming through.  You need to represent an object differently such as JSON, XML, Serialized PHP, etc. 21
  • 25. Just Decoration? • Remember decoration is just a pattern; it can help you do several things but it cannot do everything! • Don’t be afraid to utilize other patterns to assist you in the build out of your models. • The ultimate goal here is to remove the constant cost of refactoring for every feature change. 25
  • 27. The Server Components • All of the server components act approximately the same in terms of their API. • Each of them follow the same paradigm allowing you to connect them directly to a service object.  That means… this is going to be easy! • However, the server components utilize Reflection for AutoDiscovery as well as to understand the actual call. 27
  • 28. So, docblocks are always good! 28
  • 29. Implementing Servers through Controllers • Why use controllers?  Because they are already there and it fits directly into how you made your controller in the first place.  You can leverage your existing code to add them in.  Providing only a new action makes this possible.  Easily discoverable just by the URI. • In our examples – we are going to leverage an API action 29
  • 30. Putting in an API method with Zend_Json_Server 30
  • 31. It really is just that “easy” • We just implemented a JSON RPC server, wasn’t that easy? • You now have methods that you can call through a JSON RPC client based right off of your service object. • We did skip out on something, isn’t there a discoverability component? 31
  • 33. The Community Wants More • The API is now exposed, people are using it but you are getting requests for additional protocols  Where is the SOAP API?  How come there is no XML RPC API?  Everyone uses more REST based API’s, WTF? • Time to implement some more!  For now, we will implement this using a type variable. 33
  • 34. Multiple Servers – One API. 34
  • 35. So What About those Formatters? • Previously in our decoration; I showed you how to change the output by decoration. • While they can be useful sometimes; Context Switching handles much of this for you already.  So it was really just an example but may become relevant elsewhere. 35
  • 37. Versioning A couple options to help version your services.
  • 38. Versioning Services • There are a few different ways to version services; we know things will change and we need a way to support BC. • Versioning is important and can be implemented several ways. • They are not “perfect” but can and will work. 38
  • 39. Versioning by Directory • Make version directories in your models directory  Pros • Quick to implement • Individual services take on a new version  Cons • Not all services take on the same version number; more confusing to the consumer of the service. • You need to push a version parameter to your api action • You would end up implementing fallbacks based on versions not existing. 39
  • 40. Versioning by Module • Make version modules  Pros • Separation of entire service into a new module • All services take on a new version. • Simply extend the previous models.  Cons • Latest service would always be contained in a globals model folder to prevent code duplication; • Many more files; not easy to simply see what is new and what is not. • Modules work for this but; only really work if your entire api is a module and the other application is not. Which removes part of our reuse. 40
  • 41. Other Notes Things worth mentioning…
  • 42. Consumer Performance • Planning for consumer performance is important for instance:  Setting a reasonable timeout on the client end.  Messaging the user if it did timeout or some other issue occurred.  Utilizing some form of caching between the service and you (something like a squid proxy) to help boost the requests per second.  Implementing local caching and keeping track of things for that user.  Utilize parallelism; if you need to grab multiple things do them at one time.  Parsing is expensive; do it one and pass it around. 42
  • 43. Who are you? • When implementing web services; there are a few additional things to think about  Rate Limiting • Implemented more or less in a plug-in.  Authentication • Leveraging tokens or API keys. – A token service can deal with authentication and even allow them to have sessions through the service layer.  Authorization • Extending the server components to be aware of resources. – This is harder but gives fine grained control. • Otherwise, if you allow to a service they can access the entire service. 43
  • 44. Zend Framework 2 • How will this all work in ZF2?  Well; I’m not fully sure but there is an RFC! • http://framework.zend.com/wiki/display/ZFDEV2/RFC+- +Server+Classes  All I can say; is it will be better with the new EventManager • Authorization will become easier. • Plugging in will be entirely more flexible. 44
  • 45. Questions? Give me feedback: http://joind.in/3784 Slides will be posted at joind.in later this afternoon.