Mais conteúdo relacionado Semelhante a apidays LIVE Australia 2020 - The Evolution of APIs: Events and the AsyncAPI specification by Aaron Lee (20) apidays LIVE Australia 2020 - The Evolution of APIs: Events and the AsyncAPI specification by Aaron Lee1. The Evolution of APIs:
Events and the
AsyncAPI specification
APIDays LIVE Australia – Building Business Ecosystems
September 16th, 2020
Aaron Lee
Developer Advocate, Solace
@aaron-613
2. Who is Solace?
World’s foremost experts on event
distribution and messaging
middleware
‐ 21 patents
‐ 9 of top 12 Investment banks
‐ Top American & Indian telcos
‐ Air traffic management around the world
HQ and Engineering
in Ottawa, Canada
15 Global Offices
Presence in Americas, AsiaPac, Europe
2
Award-
winning
business
Award-
winning
business
9. Real Time Digital Transformation
To unlock
the value of data,
you need to set it in
motion as Event Streams
9
© Solace
Proprietary & Confidential
12. In the beginning…
• Software was monolithic and
proprietary
– Database-centric, batch-oriented systems
– Proprietary protocols and APIs
– Waterfall methodology Agile development
– Rise of open-source, open standards,
open protocols, and open APIs
– Decomposing of larger systems into
collections of microservices
– Move to real-time, increase In volume,
rethinking to Event-Driven Architectures
12© Solace
Proprietary &
Confidential
13. In the beginning…
• The Internet was simple
– Client-Server interactions for webpages
– RESTful Request-Reply HTTP protocol
– Everything understands REST: firewalls,
routers, gateways, load balancers, etc.
– But also synchronous; but also one-way
– Need for efficient, asynchronous,
bidirectional protocols
• WebSockets, MQTT, etc.
13© Solace
Proprietary &
Confidential
14. Event-Driven in Action (cont’d)
• What if you didn’t have an event mesh?
– REST over HTTP is a common communication mechanism
– Use of REST APIs to make service calls
• However:
– REST architecture is client-server by definition
– REST over HTTP is point-to-point
– HTTP is a synchronous protocol
• Would REST/HTTP fit the bill for all our communication requirements?
14
© Solace
Proprietary & Confidential
15. What does it mean
to be Event-Driven?
15
© Solace
Proprietary & Confidential
16. What does it mean to be Event-Driven?
• Real-time
• Reactive
• Asynchronous
• Non-blocking
• Decoupled / loosely-coupled
16
© Solace
Proprietary & Confidential
17. Can I use REST?
17
© Solace
Proprietary & Confidential
18. Can I use REST over HTTP?
• REST over HTTP is a common communication mechanism
• Use of REST APIs to make service calls
• However:
– REST architecture is client-server by definition
– REST over HTTP is point-to-point
– HTTP is a synchronous protocol
18
© Solace
Proprietary & Confidential
19. REST isn’t always BEST
• Great for:
–Synchronous interactions
–Externally facing APIs
• But:
–Point-to-point
–Tight service coupling
–Not natively event-driven
–Not resource efficient
19
© Solace
Proprietary & Confidential
20. Don’t Just Take It From Me..!
• https://blogs.mulesoft.com/dev/design-dev/moving-from-restful-to-eventful/
20
© Solace
Proprietary & Confidential
21. Event-Driven Integration for the Real-Time Enterprise
• Cloud native integration
platform as-a-service
– Connect and enable different
technologies to communicate
©Solace | Proprietary & Confidential
21
• Event streaming and
management platform
– Stream and manage events and other
data across all your environments (no
cloud, hybrid cloud, multi-cloud)
22. Event‐Driven Integration for the Real‐Time Enterprise
• Connectors
• Orchestration
• APIs/API
Management
• MDM
©Solace | Proprietary & Confidential
22
Cloud based
integration
Event streaming
and management
• Event mesh (dynamic
event streaming)
• Event management
and governance
• Event‐driven APIs
• Enterprise grade
Event-driven integration
24. Event-Driven Software Design
• Events are everywhere. If you’ve ever done any GUI programming:
– Button click
– Pane scroll
– Window resize
– Page load
• Game engine design:
– Fire button pressed
– Collision detection
– Object interaction
• Other examples:
– credit card swipe, ticket purchase, sensor update, stock market tick, alert raised, race start
24
© Solace
Proprietary & Confidential
25. Event-Driven Software Design (cont’d)
• Let’s get you thinking about events instead of service-oriented design
– Most developers think easily about services: methods() are blocking service calls
– Event-driven software is non-blocking, and uses lots of callbacks
• Remember your Software Design Patterns?
– Programming patterns:
• Observer pattern (Subject-Observer)
• Reactor pattern
– Architectural patterns:
• Publish-Subscribe pattern
– Good descriptions of these on Wikipedia and other online resources
25
© Solace
Proprietary & Confidential
26. Event-Driven Code
• Observer Software Design Pattern
– How can I get notified about an event, or when an object changes?
– 1 or more Observers want to be informed about state changes
– Register with the Subject
– When Subject changes, notifies Observers via callbacks
– Observers don’t have to poll Subject
26
© Solace
Proprietary & Confidential
27. Event-Driven Code (cont’d)
• Reactor Pattern
– How do I design for near real-time communication with no blocking?
– Tight loop, watching for incoming events / requests / data gives to worker threads
– When workers complete, notify reactor thread via callbacks
– Used heavily in event-driven I/O APIs, including Solace APIs
• Useful in consuming application design, to spread processing across many threads
27
© Solace
Proprietary & Confidential
28. Event-Driven Communication
• Publish-Subscribe (Pub/Sub) Architecture Pattern
– Consumers subscribe to topics of interest
– Publishers send data/events on topics
– Promotes a decoupled architecture
– Implemented by Message Brokers, or Event Brokers
28
© Solace
Proprietary & Confidential
30. • An event broker is middleware component used to transmit data and
events between producers and consumers using multiple exchange
patterns, including:
– Publish-Subscribe
– Request-Reply
– Queuing (point-to-point)
– Replay
• It should allow communication between applications to be:
– Efficient
– Bidirectional
– Asynchronous
What is an Event Broker?
30
© Solace
Proprietary & Confidential
Publish-SubscribePoint-to-Point Request-Reply
31. Is this a new technology?
• No!
• But the features and capabilities of a modern, advanced event broker
are!
• Similar technologies may be called different things:
– Message Broker
– Message Bus
– Message-Oriented Middleware
31
© Solace
Proprietary & Confidential
34. A (very) simplified Messaging API
• The absolute basics:
– connect(host, user, pw); disconnect()
– subscribe(topic); unsubscribe(topic)
– bind(queue); unbind(queue)
– publish(message, destination); // destination = [queue,topic]
– onReceive(message); // callback interface
• And for good measure:
– Message doRequest(requestMessage, destination)
34
© Solace
Proprietary & Confidential
35. Topics (in Solace)
• A Topic is more than just a label
• A topic is a description of the data contained within
– Each published message can have its own topic
– Hierarchical structure allows for levels, delimited by “/” forward slash
– Solace will use some or all of your Topic for routing and filtering
35
© Solace
Proprietary & Confidential
system/status/host1/statistics
level 1 level 2 level 3 level 4
36. Subscriptions and Wildcards
• Wildcards enable advanced routing and filtering of Messages
– A consumer-side concept, allows for a wide range of topics to match
– Two different types: single-level “*” and multi-level “>”
• Corresponds to MQTT wildcards: “+” and “#”
• In Solace, prefix wildcards:
36
© Solace
Proprietary & Confidential
system/status/host1/>
level 1 level 2 level 3 level 4
system/status/*/statistics
system/status/host*/>
37. Do you need an Event Broker? (cont’d)
• Do I really?
a) I only have a few components
b) My architecture is very simple
c) I will only ever run this in one cloud
d) I don’t need all those fancy features
• Most applications start small and simple, and grow
• It is better to design for the future to allow for growth and complexity
37
© Solace
Proprietary & Confidential
38. Protocols and Standards
• Communication protocols for distributed applications
• Standards and frameworks make interoperability easier
38
© Solace
WebSocket
39. Event Mesh Complements Service Mesh
Network
PaaS/CaaS/Virtualization
Request/Reply
Microservices
Hybrid
Microservices
Event‐Driven
Microservices
Request/Reply
Microservices
Hybrid
Microservices
Event‐Driven
Microservices
Request/Reply
Microservices
Hybrid
Microservices
Event‐Driven
Microservices
Request/Reply
Microservices
Hybrid
Microservices
Event‐Driven
Microservices
Service Mesh Event Mesh
Source: Gartner “The Key Trends in PaaS and Platform Architecture”,
28 Feb 2019, Yefim Natis, Fabrizo Biscotti, Massimo Pezzini, Paul Vincent
40. WE need to Manage
Events…
40
Because we need answers to…
• Where do you discover events/topics and the schema definition that
defines the payload?
• What logical event address (topic) do you subscribe to in order to receive
just the events you want to do something with?
• Why does a given event exist, i.e. what is it’s context and purpose. And if
you can’t figure that out…
• Who do you contact to learn more about more events and their
context/purpose?
• When will a given event be available or deprecated?
• How do developers/Architects define their event-driven application
interfaces, How do they generate code?
41. Code Gen from a
Topic Schema?
41
© Solace
Proprietary & Confidential
42. Answers the Who,
What, When, Where,
Why and How For
RESTful APIs…but
what about Events?
OpenAPI + API Management Platforms Solved this for REST!
API
Gateway
API
Gateway
Documentation
• Discover
Registration
• Govern
Analysis
• Improve
• Monetize
Community
• Collaborate
Architects and
Developers
(Internal, Partner
and Third‐Party)
Productivity
• Generate Code
API
Portal
API
Portal
43. We need a Machine-Readable Application Spec
43
© Solace
Proprietary & Confidential
44. We Need an Event Platform for Async Interactions
Architects and
Developers
(Internal, Partner
and Third‐Party)
45. OpenAPI… AsyncAPI
45
© Solace
Proprietary & Confidential
OpenAPI
Specification
Swagger
Codegen
Generated
Code
Async
Specification
AsyncAPI
Codegen
SynchronousAsynchronous
…
HTTP
amqp,
amqps, mqtt,
mqtts, ws,
wss
Generated
Code
Runtime
Protocol
Runtime
Protocol
46. Sinks
“While most organizations have
basic event processing
infrastructure - such as
notification services, message
buses, and event brokers -
many don’t have the high-level
productivity tooling that helps
developers design, develop, test
and manage event-centric
applications. Nor do they have
tools for governing, publishing
and managing event-based
interfaces. The market for these
tools is sparse.”
Gartner “Top 3 Trends in Application Architecture That Enable
Digital Business” Anne Thomas, Yefim Natis, Mark O’Neill, 28
Oct 2019
46
© Solace
Event
Broker
Event
Broker
Security
Persistence
Protocol
Translation
One-to-Many
Distribution
Source
Runtime
We Need an Event Portal
for Asynchronous Interactions
Design, Develop
and Manage
Event
Portal
Event
Portal
Documentation
• Discover
Registration
• Govern
Analysis
• Improve
• Monetize
Community
• Collaborate
Productivity
• Generate Code (code gen)
(spec)
47. 47
© Solace
Single place to design, create, catalog, visualize, discover,
share, secure and manage all events within your
ecosystem
Introducing Event Portal
Event PortalEvent Portal
Mainframe/
SAP
Distributed
Apps IoTMicro
services
Server
Less
Event BrokersEvent Brokers
48. The Who, What, When, Where, Why and How of Events:
• Who produces and consumes each event?
• What is the event payload format?
• Where do we go to discover events?
• When will a given event be available or deprecated?
• Why does a given event exist? Context?
• How do we define event-driven applications?
• How do we generate code?
48
© Solace
Proprietary & Confidential
How do you govern all of this!?!
49. API Management Platforms Solved This for REST!
49
© Solace
Proprietary & Confidential
Answers the Who, What, When, Where, Why and How
For RESTful APIs… But not Events…
API
Portal
API
Portal
API
Gateway
API
Gateway
Documentation:
• Discover
Registration:
• Govern
Analysis:
• Improve
• Monetize
Community:
• Collaborate
Internal, Partner &
Third‐Party
Architects and
Developers
50. 2019
“The continuing shortage of productivity and
governance tools, best practices and
technology standards keeps this ultimate
commitment experience of EDA off the real-
world roadmaps of most organizations today.”
Gartner: Gartner “The 5 Steps Toward Pervasive Event-Driven Architecture”, 28 June 2019, Yefim Natis, Massimo Pezzini, Keith Guttridge, W. Roy Schulte
51. Event Portal for the Asynchronous World
51
© Solace
Proprietary & Confidential
Purpose Built for the Event‐Driven Enterprise
Event
Portal
Event
Portal
Event
Broker
Event
Broker
Documentation:
• Discover
Registration:
• Govern
Analysis:
• Improve
• Monetize
Community:
• Collaborate
Internal, Partner &
Third‐Party
Architects and
Developers
52. An Event Platform for Async Interactions
52
© Solace
Proprietary & Confidential
Event
Broker
Event
Broker
Security
Persistence
Protocol Translation
1..Many Distribution
Event Source
Event Sinks
Event
Portal
Event
Portal
Documentation:
• Discover
Registration:
• Govern
Analysis:
• Improve
• Monetize
Community:
• Collaborate
Internal, Partner &
Third‐Party
Architects and
Developers
Runtime Event Mesh
Event Driven App
Design, Develop
&
Management
53. Simple Model, Powerful Results
• Event Portal Foundational Elements
– Application Domains: decomposes
enterprise
– Schema: payload object definition. JSON,
Avro, XML schema
– Event: topic address + metadata.
References a payload schema
– Application: consumes and/or produces
events
• Tracking relationships between
elements is key!
Event Portal
Application Domain
payload
schema
event eventapplication
consumes produces
payload
schema
54. What Capabilities the Event Portal Provides
• Designer
– Catalog
– Discovery
– Version Control
– Import/Export
– Choreography
Visualizations
– External Portal
– Collaboration
– Runtime Discovery
• Operator
– Runtime Audit
– Broker Configuration
– Application Runtime
Monitoring
– Runtime Choreography
Visualizations