Cloud Event Driven Architectures with
Spring Cloud Stream 2.0
Oleg Zhurakousky
@z_oleg
1
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Scope
2
• What is Cloud?
• What is Event and Event driven Architecture?
• Problem statement
• Putting it all together with Spring
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Cloud
3
• Ecosystem that integrates platforms and middleware into one cohesive hybrid
runtime.
• Messaging (JMS, AMQP, Kafka, etc.)
• File Systems
• Databases
• Etc. . .
• Outsources infrastructure concerns to the cloud provider via cloud
connectors/services
• Provides mechanism for applications services (clients) to interact with cloud
services.
• Naturally Event oriented
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Events
4
• Event - representation of a state change
• Always in past tense
• Events are delivered in a form or protocol specific records using some Messaging
middleware.
• Many delivery mechanisms
• HTTP (REST)
• Publish/Subscribe
• variation of pipes-and-filters pattern
• multiple subscribers
• Events contain meta-data (i.e., event type)
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Events
5
• Event - representation of a state change
• Always in past tense
• Events are delivered in a form or protocol specific records using some Messaging
middleware.
• Many delivery mechanisms
• HTTP (REST)
• Publish/Subscribe
• variation of pipes-and-filters pattern
• multiple subscribers
• Events contain meta-data (i.e., event type)
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Problem
6
• Single JVM deployment model
• Limits management and lifecycle characteristic of your service
• Shared resources
• Infrastructure may leak into your app code
• Duplication of effort
• Cross platform integration
• Event representation - transformation/conversion/serialization
• Content-based routing (data or meta-data)
• Different programming models - imperative vs declarative (functional)
Putting it together
Putting it together
Spring Integration
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Integration
9
• Messaging framework which provides implementation of EIP
on top of Spring Messaging
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Integration
10
Messaging framework which provides implementation of EIP on
top of Spring Messaging
Demo
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Integration
11
• Pros/Cons
• Handles message dispatching while exposing POJO-based flexible
application development model
• Shares resources
Putting it together
Putting it together
Spring Cloud Stream
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Cloud Stream
14
• Framework for building message-driven micro services
• Provides boot-driven integration with Messaging Brokers using Binders
• Leverages native features of brokers while also providing a workaround for not
supported features.
• Partitioning
• Consumer Groups
• Message Headers
• Destination provisioning
• Honors application configurations by the underlying frameworks (spring-integration,
spring-kafka etc.)
• Kafka & Rabbit are currently supported
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Cloud Stream
15
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Cloud Stream
16
PubSub destinations
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Cloud Stream
17
PubSub destinations
Content negotiation
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Cloud Stream
18
PubSub destinations
Content negotiation
Consumer groups, partitioning etc.
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Cloud Stream - summary
19
• Durable Publish-Subscribe messaging
• For easily creating complex topologies
• Consumer groups
• Multiple instances can be competing consumers when scaling
• Declarative data partitioning
• Colocating related data in consumer instances (Kafka, Rabbit etc)
• Content negotiation
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Cloud Stream - programming model
20
• Spring Cloud Stream - Spring Boot app
• Flexible configuration (i.e., Annotation, XML, hybrid)
• Binders
• Streaming
• KStream
• Channel-based
• Kafka
• Rabbit
• Seamless integration with the rest of the Spring Cloud stack
• Metrics
• Sleuth
• Config
• Circuit Braker
• Etc.
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Cloud Stream - programming model
22
• Imperative
• Declarative
Putting it together
Spring Cloud Stream - DEMO
Unless otherwise indicated, these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative
Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/
Spring Cloud Stream - Links
24
• http://cloud.spring.io/spring-cloud-stream
• https://github.com/spring-cloud/spring-cloud-stream
• https://github.com/spring-cloud/spring-cloud-stream-binder-kafka
• https://github.com/spring-cloud/spring-cloud-stream-binder-rabbit
Learn More. Stay Connected.
Thank you!
25
#springone@s1p

Cloud Event Driven Architectures with Spring Cloud Stream 2.0

  • 1.
    Cloud Event DrivenArchitectures with Spring Cloud Stream 2.0 Oleg Zhurakousky @z_oleg 1
  • 2.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Scope 2 • What is Cloud? • What is Event and Event driven Architecture? • Problem statement • Putting it all together with Spring
  • 3.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Cloud 3 • Ecosystem that integrates platforms and middleware into one cohesive hybrid runtime. • Messaging (JMS, AMQP, Kafka, etc.) • File Systems • Databases • Etc. . . • Outsources infrastructure concerns to the cloud provider via cloud connectors/services • Provides mechanism for applications services (clients) to interact with cloud services. • Naturally Event oriented
  • 4.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Events 4 • Event - representation of a state change • Always in past tense • Events are delivered in a form or protocol specific records using some Messaging middleware. • Many delivery mechanisms • HTTP (REST) • Publish/Subscribe • variation of pipes-and-filters pattern • multiple subscribers • Events contain meta-data (i.e., event type)
  • 5.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Events 5 • Event - representation of a state change • Always in past tense • Events are delivered in a form or protocol specific records using some Messaging middleware. • Many delivery mechanisms • HTTP (REST) • Publish/Subscribe • variation of pipes-and-filters pattern • multiple subscribers • Events contain meta-data (i.e., event type)
  • 6.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Problem 6 • Single JVM deployment model • Limits management and lifecycle characteristic of your service • Shared resources • Infrastructure may leak into your app code • Duplication of effort • Cross platform integration • Event representation - transformation/conversion/serialization • Content-based routing (data or meta-data) • Different programming models - imperative vs declarative (functional)
  • 7.
  • 8.
  • 9.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Spring Integration 9 • Messaging framework which provides implementation of EIP on top of Spring Messaging
  • 10.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Spring Integration 10 Messaging framework which provides implementation of EIP on top of Spring Messaging Demo
  • 11.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Spring Integration 11 • Pros/Cons • Handles message dispatching while exposing POJO-based flexible application development model • Shares resources
  • 12.
  • 13.
  • 14.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Spring Cloud Stream 14 • Framework for building message-driven micro services • Provides boot-driven integration with Messaging Brokers using Binders • Leverages native features of brokers while also providing a workaround for not supported features. • Partitioning • Consumer Groups • Message Headers • Destination provisioning • Honors application configurations by the underlying frameworks (spring-integration, spring-kafka etc.) • Kafka & Rabbit are currently supported
  • 15.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Spring Cloud Stream 15
  • 16.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Spring Cloud Stream 16 PubSub destinations
  • 17.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Spring Cloud Stream 17 PubSub destinations Content negotiation
  • 18.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Spring Cloud Stream 18 PubSub destinations Content negotiation Consumer groups, partitioning etc.
  • 19.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Spring Cloud Stream - summary 19 • Durable Publish-Subscribe messaging • For easily creating complex topologies • Consumer groups • Multiple instances can be competing consumers when scaling • Declarative data partitioning • Colocating related data in consumer instances (Kafka, Rabbit etc) • Content negotiation
  • 20.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Spring Cloud Stream - programming model 20 • Spring Cloud Stream - Spring Boot app • Flexible configuration (i.e., Annotation, XML, hybrid) • Binders • Streaming • KStream • Channel-based • Kafka • Rabbit • Seamless integration with the rest of the Spring Cloud stack • Metrics • Sleuth • Config • Circuit Braker • Etc.
  • 21.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Spring Cloud Stream - programming model 22 • Imperative • Declarative
  • 22.
    Putting it together SpringCloud Stream - DEMO
  • 23.
    Unless otherwise indicated,these slides are © 2013 -2017 Piv otal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by -nc/3.0/ Spring Cloud Stream - Links 24 • http://cloud.spring.io/spring-cloud-stream • https://github.com/spring-cloud/spring-cloud-stream • https://github.com/spring-cloud/spring-cloud-stream-binder-kafka • https://github.com/spring-cloud/spring-cloud-stream-binder-rabbit
  • 24.
    Learn More. StayConnected. Thank you! 25 #springone@s1p

Editor's Notes

  • #3 The emergence of microservices and cloud native architectures has triggered a resurgence of interest in Event Driven Architectures where Event is one of the building blocks and the primary mechanism for enabling eventual consistency in a distributed system. But what is Cloud Native Architectures? What is Event and Event Driven Arch? Not something that is new. In fact it is not new at all but it is evolving in such speed that we constantly need to redefine, clarify, expend and formulate what does it really mean to us? If ask people to define the cloud what are the chances I’ll get the same answer?
  • #4 Allows clients to communicate and integrate with one another using cloud-managed shared services
  • #5 LocalTime.now(); - not true
  • #6 LocalTime.now(); - not true