Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Getting started with Event-Driven Architectures in 2023 (Øredev)

Getting started with Event-Driven Architectures in 2023 (Øredev)

Event-driven architectures are not new and can solve many difficult problems in modern enterprise workloads. You always found them interesting but never managed to implement one? The technology choices are overwhelming for you? You are confused if you need a service bus, a process engine or a different type of integration component for it?

Join this session to get started with Event-Driven Architectures in 2023. We’ll start with a recap of enterprise integration patterns and walk you through an example implementation in Java afterwards. You’ll leave with a public Git repo containing code and instructions so you may also run through it on your own. Java is not your favorite language? We’ll also provide repos with .NET, Python and TypeScript examples.

Dennis Kieselhorst

November 09, 2023
Tweet

More Decks by Dennis Kieselhorst

Other Decks in Technology

Transcript

  1. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Getting started with
    Event-Driven
    Architectures in 2023
    Maximilian Schellhorn
    Senior Solutions Architect
    Amazon Web Services
    Dennis Kieselhorst
    Principal Solutions Architect
    Amazon Web Services

    View full-size slide

  2. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Amazon.com Architecture in 1995
    Internet
    Obidos
    (web server)
    Customers Inventory
    Orders
    Distribution center
    Amazon.co
    m
    CC motel
    (credit card)
    Amazon.com Books

    View full-size slide

  3. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    1998 – Distributed Computing Manifesto
    “The applications (clients) would no longer be able to access the
    database directly, but only through a well-defined interface that
    encapsulates the business logic required to perform the
    function.”
    https://www.allthingsdistributed.com/2022/11/amazon-1998-distributed-computing-manifesto.html

    View full-size slide

  4. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Scalability
    S O A – 2 0 0 0
    Internet
    Obidos
    Distribution Center
    CC motel
    Customers
    Customer service
    Orders
    Inventory
    ACB CustNA
    Distribution center

    View full-size slide

  5. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Store products in the warehouse
    Pick products for customers Report defects
    Track shipments
    Product Details
    DB
    DB
    DB
    DB
    DB
    Web of Microservices

    View full-size slide

  6. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Amazon Architecture 2023

    View full-size slide

  7. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. 9
    Let’s review:
    Synchronous HTTP
    microservices

    View full-size slide

  8. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Microservices with synchronous integration
    201 201

    View full-size slide

  9. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Challenges with synchronous distributed systems
    Ordering
    Fulfill
    Order
    Payment
    Loyalty
    User

    View full-size slide

  10. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Challenges with synchronous distributed systems
    Ordering
    Fulfill
    Order
    Payment
    Loyalty
    User
    ERROR: 500

    View full-size slide

  11. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Challenges with synchronous distributed systems
    Ordering
    Fulfill
    Order
    Payment
    Loyalty
    User
    Response time: 10 seconds
    Is the Loyalty service a requirement
    to complete an order?

    View full-size slide

  12. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Challenges with synchronous distributed systems
    Ordering
    Fulfill
    Order
    Payment
    Loyalty
    User
    What happens as the system
    becomes more complex?
    CRM

    View full-size slide

  13. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Long-term architecture?
    Fulfill
    Order
    Payment
    Loyalty

    View full-size slide

  14. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Event-driven architectures (EDA)
    An architectural style of building
    loosely-coupled software systems that
    work together by emitting and
    responding to events.
    17

    View full-size slide

  15. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Event-driven architectures (EDA)
    An architectural style of building
    loosely-coupled software systems that
    work together by emitting and
    responding to events.
    18

    View full-size slide

  16. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    event
    A signal that a
    system’s state has
    changed. Immutable
    facts that have
    occurred in the past.

    View full-size slide

  17. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Properties of events
    • Events are signals that a system’s
    state has changed
    • Events occur in the past
    (e.g. OrderCreated)
    • Events cannot be changed
    (immutable)
    • Decrease coupling by restricting
    information to key data
    "source": "com.orders",
    "detail-type":
    "detail":
    "metadata":
    "idempotency-key":
    "data":
    "order-id"

    View full-size slide

  18. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Sparse events vs. full state descriptions
    123
    10:47 a.m. 456
    123 10:47 a.m.
    456.
    Open $57.51. The

    View full-size slide

  19. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Event Driven Architectures
    123
    10:47
    a.m.
    456
    Event Event
    broker
    Fulfill
    Order
    Payment
    Loyalty
    123

    View full-size slide

  20. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    If your application is cloud-native, or
    large-scale, or distributed, and doesn’t
    include a messaging component, that’s
    probably a bug.
    Tim Bray
    27

    View full-size slide

  21. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Friends don’t let friends rely on
    synchronous integration
    Dirk Fröhner
    Principal Solutions Architect, AWS
    28

    View full-size slide

  22. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    In an event-driven architecture, systems and
    development teams communicate via events
    30
    Event
    broker
    Producer
    Event producers are
    systems that detect a
    change in state or notice
    updates and publish those
    facts. Application code, a
    database or a time-based
    trigger can serve as event
    producers, among other
    things.
    An event broker is a
    meeting place between
    the producers and
    consumers. The broker
    is how events are
    exchanged.
    Consumer/ Subscriber
    Event consumers are
    systems that listen for
    events and use them for
    their purposes. It’s possible,
    and common, for a
    consumer to receive an
    event, perform some work
    and publish its event in
    response.

    View full-size slide

  23. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Different types of channels
    Point-to-point (queue) Publish-subscribe (topic)
    Publisher(s)
    Topic
    Subscribers
    Sender(s)
    Queue
    Receivers
    B A
    C B
    A
    C
    B A
    C B A
    C
    B A
    C
    B A
    C
    Each message consumed by one receiver Each message consumed by each subscriber

    View full-size slide

  24. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Implementing EDA
    in 2023

    View full-size slide

  25. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Serverless AWS native
    Point-to-point (queue) Publish-subscribe / fan-out (topic)
    Publisher(s) Subscribers
    Sender(s) Receivers
    Amazon Simple Queue Service
    (Amazon SQS)
    Amazon Simple Notification Service
    (Amazon SNS)
    B A
    C B A
    C
    B A
    C
    B A
    C
    B A
    C B
    A
    C

    View full-size slide

  26. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Serverless was designed for the event-driven model
    35
    No infrastructure to
    provision or manage
    Automatically scale
    to millions of users
    Pay per use
    billing model
    Highly available
    and durable
    OFF

    View full-size slide

  27. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Serverless was designed for the event-driven model
    Only run when invoked by events
    Built-in features and integrations for working with events
    Focus on business logic, not infrastructure management
    36
    Paying for idle
    Capacity cost Capacity utilization

    View full-size slide

  28. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Managed Open Source
    Point-to-point (queue) Publish-subscribe / fan-out (topic)
    Publisher(s) Subscribers
    Sender(s) Receivers
    Amazon MQ – managed RabbitMQ
    or Apache ActiveMQ
    Amazon Managed Streaming for Apache Kafka
    B A
    C B A
    C
    B A
    C
    B A
    C
    B A
    C B
    A
    C

    View full-size slide

  29. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Message routing
    Message filter
    Receive only relevant subset of messages
    Publisher(s)
    Topic
    Subscribers
    C A
    D B
    C B
    D A C B
    D A

    View full-size slide

  30. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Amazon EventBridge architecture
    Partner
    event source
    Rules
    Default event bus
    Custom event bus
    SaaS event bus
    Amazon EventBridge

    View full-size slide

  31. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Introducing Unicorn Properties
    Our use case is based on a real estate
    company called Unicorn Properties
    As a real estate agency, Unicorn Properties
    needs to
    1. manage the publication of new property
    listings
    2. manage contracts linked to individual
    properties
    3. provide a way for their customers to view
    approved property listings

    View full-size slide

  32. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Contracts API
    Property images
    S3 bucket
    Agent
    Contracts
    table
    Properties
    Web API
    Search
    function
    Approval
    function
    Publication
    evaluation event
    handler
    Customer
    Unicorn
    Properties
    event bus
    Properties
    table
    Agent
    Contracts
    function
    Unicorn.Contracts
    Unicorn.Web
    Contract status
    table
    Property Publishing
    Approval workflow
    Contract status changed
    event handler
    Contract status
    checker
    Property
    approvals sync
    SendTaskSuccess
    Unicorn.Properties
    Wait for contract
    approval
    Parameter Store
    The architecture
    Unicorn Contracts
    Unicorn Properties Web
    Unicorn Properties
    1
    3
    2

    View full-size slide

  33. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Hands-on workshop
    Supported by fully functional reference architectures
    s12d.com/aws-sde-python s12d.com/aws-sde-ts s12d.com/aws-sde-java s12d.com/aws-sde-dotnet
    Python TypeScript Java C#
    Instructions
    https://catalog.workshops.aws/serverless-developer-experience

    View full-size slide

  34. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Another example: Managed Care Plan
    Domain: Provider Management Domain: Patient Care Plan
    Manage Availability
    Create Care Provider Profiles Create Patient Profile
    Search, Manage and Book
    Care Provider Availability

    View full-size slide

  35. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Amazon EKS
    Managed Care Plan running on Kubernetes
    Streams
    Care Provider
    Connect
    Amazon RDS
    PostgreSQL
    provider-schedule
    service
    (Spring Boot)
    care-plan
    Service
    (Spring Boot)
    Patient
    Amazon RDS
    PostgreSQL
    https://github.com/aws-samples/event-driven-careplan-on-eks

    View full-size slide

  36. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Takeaways
    In an event-driven architecture,
    systems and development teams
    communicate via events.
    EDAs can give you:
    • Greater developer agility and extensibility
    • Increased scalability and fault tolerance
    • Lower total cost of ownership
    Serverless services are uniquely
    compatible with EDA.
    53

    View full-size slide

  37. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Q&A

    View full-size slide

  38. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Learn more
    Event-Driven Architectures
    on Serverless Land
    • Workshops
    • Guides
    • Architecture patterns
    55
    https://serverlessland.com
    /event-driven-
    architecture/intro

    View full-size slide

  39. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Thank you!
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    https://aws.amazon.com/contact-us/

    View full-size slide

  40. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Appendix

    View full-size slide

  41. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Lego uses an event-driven design for scalability
    58
    Commerce
    platform
    Order &
    customer updates
    Event
    relay
    Amazon
    EventBridge
    Login
    Customer
    login
    Checkout
    Submit
    order
    Order
    Process
    order
    Shipping
    Send order
    to SAP
    Data sync
    Customer, VIP,
    wishlist sync
    Payment
    Authorize
    payment
    FIFO queue
    Customer
    login
    Invoke every
    minute
    Order
    complete
    Events
    Payment
    authorized
    Customer
    login
    Order
    complete
    Order
    submit
    • Lego’s traffic spikes on peak
    days —leading to a 2017
    Black Friday crash
    • An event-driven design scales
    automatically, eliminating the
    problem of crashing during peaks

    View full-size slide

  42. GETTING STARTED WITH EVENT-DRIVEN ARCHITECTURES IN 2023
    © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Processing 8.1M mail items per day with events at
    PostNL
    59
    AWS
    Community
    Day Benelux
    2021

    View full-size slide