際際滷

際際滷Share a Scribd company logo
息 Copyright 2018 Pivotal Software, Inc. All rights Reserved. Version 1.0
Quickstart your Event Driven Architecture
Ben Wilcock, Pivotal @benbravo73
Steven van Beelen, AxonIQ @smcvbeelen
&
 A Reference Architecture
 Open-source
 CQRS & Event Sourcing
 Spring Boot
 Axon Framework
 PCF (Pivotal Web Services)
 URL axontrader.cfapps.io
Introducing Axon Trader
Spring Boot
Javas most popular microservices framework
 Is there anyone who hasnt heard of SpringBoot?
 Fast, easy to build stand-alone Spring applications
 Opinionated starter dependencies that autoconfigure
 starter-web is great for RESTful microservices
 Embeds Tomcat, Jetty or Undertow
 Production-ready features (metrics, health, config)
 Easy to get started with guides & initializer
 https://spring.io/projects/spring-boot
Axon
Solving non-functional app complexity in Message-Driven systems
 Open Source (Apache 2 License) Java framework
 First-class support for CQRS, DDD and EDA concepts
 Aggregates & Aggregate Roots
 Commands, Queries and Events
 Event Sourcing
 Sagas
 Helps focusing on the business functionality in your application
 https://axoniq.io/
PCF
The premier platform for cloud-native development
 Focussed on developer productivity
 The fastest path to production
 Fully polyglot with support for Java, .Net, NodeJS, Python, etc.
 Marketplace services - DBs, MQs, APMs, etc.
 Highly automatable & CI / CD friendly
 Deploy code to production 000s of times a month!
 Available online via Pivotal Web Services (PWS) at run.pivotal.io
C(ommand) Q(uery) R(esponsibility) S(egregation)
Domain
logic
Projections
Client
Events
Commands Queries
CQRS, what is it?
Wallet
Id: 123
Owner: Steven
Balance: 1000
Event Sourcing, what is it?
C.R.U.D. Event Sourcing
WalletCreatedEvent:
Id: 123, Owner: Steven
> Balance: 0
CashDepositedEvent: 1500
> Balance: 1500
CashWithdrawnEvent: 500
> Balance: 1000
CashWithdrawnEvent: 500
> Balance: 500
CashDepositedEvent: 500
> Balance: 1000Balance is persisted, but how we got here isnt clear.
Great for projections and views, but somewhat lossy.
Example: Virtual Wallet
"Event" and Message" are not the same thing!
PublicAPI
Message Driven APIs: what do they consist of?
Commands
Route to single handler
Use consistent hashing
Return a result
Events
Distribute to all event handlers
Consumers express ordering reqs
Return no result
Can be persisted
Can be a source of agg. state
Can be used to build projections
Queries
Route with load balancing
Sometimes scatter/gather
Return a result
Virtual Wallet: lets code it!
Demo: Commissioning MySQL Database with PCF...
No DBAs. No IT tickets. Just two simple commands:
 cf create-service
 Provisions a tablespace with inline with the selected plan
 Fully automated - no manual steps
 cf bind-service
 Creates a dedicated user for the application with credentials
 Adds the connection string and credentials into the applications
environment variables (picked up automatically by SpringBoot)
No servers. No containers. No ssh. Just one simple command:
 cf push
 Uploads your code to Cloud Foundry
 Layers required runtimes (e.g. JVM) onto a hardened container
 Sets up a route (URL) for your app
 Creates a load balancing entry for each instance
 Sets up SSL termination and mTLS
 Creates health monitoring & logging subsystems
 Binds all required backing services (database, messaging etc.)
 Schedules your app container to start
 Starts your app with the desired number of instances (scale)
 Automatically restarts your app should it ever stop...
Demo: Pushing code to production with PCF...
But how does this help us..?
Pivotal Services MarketplacePivotal Cloud Foundry (PAS)
CPI (Multi-cloud Cloud Provider API)
Application Code & Frameworks Buildpacks | Spring Boot & Java | .NET | NodeJS | Python | Go | Staticfile | PHP | Ruby
cf push | cf create-service | cf bind-service
vSphere
Azure &
Azure StackGoogle CloudAWSOpenstack
Marketplace for Pivotal and Partner Products
Public Cloud
Services
Customer
Managed
Services
OpenServiceBrokerAPI
MySQL Relational DB
Spring Cloud Services
(Registry, Config, etc.)
Rabbit MQ Messaging
Redis Key Value Store
Trader UI
Home
Dashboard
Order Books
Users
Images
Layout
Application starts life as
a monolith which is easier
to design and build
Trader App
Companies
Users
Portfolios
Order Books
Evolutionary
Architecture
Pivotal Services MarketplacePivotal Cloud Foundry (PAS)
CPI (Multi-cloud Cloud Provider API)
Application Code & Frameworks Buildpacks | Spring Boot & Java | .NET | NodeJS | Python | Go | Staticfile | PHP | Ruby
cf push | cf create-service | cf bind-service
vSphere
Azure &
Azure StackGoogle CloudAWSOpenstack
Marketplace for Pivotal and Partner Products
Public Cloud
Services
Customer
Managed
Services
OpenServiceBrokerAPI
MySQL Relational DB
Spring Cloud Services
(Registry, Config, etc.)
Rabbit MQ Messaging
Redis Key Value Store
Trading Engine
Order Books
Portfolios
Then we strangle the monolithusing location transparency andadding services
Trader UI
Home
Dashboard
Order Books
Users
Images
Layout
Trader App
Companies
Users
Pivotal Services MarketplacePivotal Cloud Foundry (PAS)
CPI (Multi-cloud Cloud Provider API)
Application Code & Frameworks Buildpacks | Spring Boot & Java | .NET | NodeJS | Python | Go | Staticfile | PHP | Ruby
cf push | cf create-service | cf bind-service
vSphere
Azure &
Azure StackGoogle CloudAWSOpenstack
Marketplace for Pivotal and Partner Products
Public Cloud
Services
Customer
Managed
Services
OpenServiceBrokerAPI
MySQL Relational DB
Spring Cloud Services
(Registry, Config, etc.)
Rabbit MQ Messaging
Redis Key Value Store
Trading EngineTrader App
Companies
Users Order Books
Portfolios
Trading Engine iN
Order Books
Portfolios
Finally, separating ourapplication into microservicesmakes it easier to maintainand scale
Trader UI
Home
Dashboard
Order Books
Users
Images
Layout
Whats next?
Coming Soon
Axon Server in the Pivotal Service Marketplace
Were working on getting Axon Server into the PCF marketplace allowing dedicated
on-demand Event Store, Command, Query and Event routing services
&
$> cf create-service axon-server
Check it out!
Thanks for attending!
Wallet RepoAxon Trader
Ben Wilcock, Pivotal @benbravo73
Steven van Beelen, AxonIQ @smcvbeelen steven@axoniq.io

More Related Content

Devoxx 2018 - Pivotal and AxonIQ - Quickstart your event driven architecture

  • 1. 息 Copyright 2018 Pivotal Software, Inc. All rights Reserved. Version 1.0 Quickstart your Event Driven Architecture Ben Wilcock, Pivotal @benbravo73 Steven van Beelen, AxonIQ @smcvbeelen &
  • 2. A Reference Architecture Open-source CQRS & Event Sourcing Spring Boot Axon Framework PCF (Pivotal Web Services) URL axontrader.cfapps.io Introducing Axon Trader
  • 3. Spring Boot Javas most popular microservices framework Is there anyone who hasnt heard of SpringBoot? Fast, easy to build stand-alone Spring applications Opinionated starter dependencies that autoconfigure starter-web is great for RESTful microservices Embeds Tomcat, Jetty or Undertow Production-ready features (metrics, health, config) Easy to get started with guides & initializer https://spring.io/projects/spring-boot
  • 4. Axon Solving non-functional app complexity in Message-Driven systems Open Source (Apache 2 License) Java framework First-class support for CQRS, DDD and EDA concepts Aggregates & Aggregate Roots Commands, Queries and Events Event Sourcing Sagas Helps focusing on the business functionality in your application https://axoniq.io/
  • 5. PCF The premier platform for cloud-native development Focussed on developer productivity The fastest path to production Fully polyglot with support for Java, .Net, NodeJS, Python, etc. Marketplace services - DBs, MQs, APMs, etc. Highly automatable & CI / CD friendly Deploy code to production 000s of times a month! Available online via Pivotal Web Services (PWS) at run.pivotal.io
  • 6. C(ommand) Q(uery) R(esponsibility) S(egregation) Domain logic Projections Client Events Commands Queries CQRS, what is it?
  • 7. Wallet Id: 123 Owner: Steven Balance: 1000 Event Sourcing, what is it? C.R.U.D. Event Sourcing WalletCreatedEvent: Id: 123, Owner: Steven > Balance: 0 CashDepositedEvent: 1500 > Balance: 1500 CashWithdrawnEvent: 500 > Balance: 1000 CashWithdrawnEvent: 500 > Balance: 500 CashDepositedEvent: 500 > Balance: 1000Balance is persisted, but how we got here isnt clear. Great for projections and views, but somewhat lossy. Example: Virtual Wallet
  • 8. "Event" and Message" are not the same thing! PublicAPI Message Driven APIs: what do they consist of? Commands Route to single handler Use consistent hashing Return a result Events Distribute to all event handlers Consumers express ordering reqs Return no result Can be persisted Can be a source of agg. state Can be used to build projections Queries Route with load balancing Sometimes scatter/gather Return a result
  • 10. Demo: Commissioning MySQL Database with PCF... No DBAs. No IT tickets. Just two simple commands: cf create-service Provisions a tablespace with inline with the selected plan Fully automated - no manual steps cf bind-service Creates a dedicated user for the application with credentials Adds the connection string and credentials into the applications environment variables (picked up automatically by SpringBoot)
  • 11. No servers. No containers. No ssh. Just one simple command: cf push Uploads your code to Cloud Foundry Layers required runtimes (e.g. JVM) onto a hardened container Sets up a route (URL) for your app Creates a load balancing entry for each instance Sets up SSL termination and mTLS Creates health monitoring & logging subsystems Binds all required backing services (database, messaging etc.) Schedules your app container to start Starts your app with the desired number of instances (scale) Automatically restarts your app should it ever stop... Demo: Pushing code to production with PCF...
  • 12. But how does this help us..?
  • 13. Pivotal Services MarketplacePivotal Cloud Foundry (PAS) CPI (Multi-cloud Cloud Provider API) Application Code & Frameworks Buildpacks | Spring Boot & Java | .NET | NodeJS | Python | Go | Staticfile | PHP | Ruby cf push | cf create-service | cf bind-service vSphere Azure & Azure StackGoogle CloudAWSOpenstack Marketplace for Pivotal and Partner Products Public Cloud Services Customer Managed Services OpenServiceBrokerAPI MySQL Relational DB Spring Cloud Services (Registry, Config, etc.) Rabbit MQ Messaging Redis Key Value Store Trader UI Home Dashboard Order Books Users Images Layout Application starts life as a monolith which is easier to design and build Trader App Companies Users Portfolios Order Books Evolutionary Architecture
  • 14. Pivotal Services MarketplacePivotal Cloud Foundry (PAS) CPI (Multi-cloud Cloud Provider API) Application Code & Frameworks Buildpacks | Spring Boot & Java | .NET | NodeJS | Python | Go | Staticfile | PHP | Ruby cf push | cf create-service | cf bind-service vSphere Azure & Azure StackGoogle CloudAWSOpenstack Marketplace for Pivotal and Partner Products Public Cloud Services Customer Managed Services OpenServiceBrokerAPI MySQL Relational DB Spring Cloud Services (Registry, Config, etc.) Rabbit MQ Messaging Redis Key Value Store Trading Engine Order Books Portfolios Then we strangle the monolithusing location transparency andadding services Trader UI Home Dashboard Order Books Users Images Layout Trader App Companies Users
  • 15. Pivotal Services MarketplacePivotal Cloud Foundry (PAS) CPI (Multi-cloud Cloud Provider API) Application Code & Frameworks Buildpacks | Spring Boot & Java | .NET | NodeJS | Python | Go | Staticfile | PHP | Ruby cf push | cf create-service | cf bind-service vSphere Azure & Azure StackGoogle CloudAWSOpenstack Marketplace for Pivotal and Partner Products Public Cloud Services Customer Managed Services OpenServiceBrokerAPI MySQL Relational DB Spring Cloud Services (Registry, Config, etc.) Rabbit MQ Messaging Redis Key Value Store Trading EngineTrader App Companies Users Order Books Portfolios Trading Engine iN Order Books Portfolios Finally, separating ourapplication into microservicesmakes it easier to maintainand scale Trader UI Home Dashboard Order Books Users Images Layout
  • 16. Whats next? Coming Soon Axon Server in the Pivotal Service Marketplace Were working on getting Axon Server into the PCF marketplace allowing dedicated on-demand Event Store, Command, Query and Event routing services & $> cf create-service axon-server
  • 17. Check it out! Thanks for attending! Wallet RepoAxon Trader Ben Wilcock, Pivotal @benbravo73 Steven van Beelen, AxonIQ @smcvbeelen steven@axoniq.io