Event-driven microservices architecture is an approach where communication between different microservices is based on events. In this architecture, microservices communicate asynchronously by producing and consuming events. Events represent significant changes or occurrences within the system, and they are typically small, immutable, and carry only the necessary information.
2. Lack of etiquette and manners is a huge turn off.
KnolX Etiquettes
Punctuality
Join the session 5 minutes prior to the session start time. We start on
time and conclude on time!
Feedback
Make sure to submit a constructive feedback for all sessions as it is very
helpful for the presenter.
Silent Mode
Keep your mobile devices in silent mode, feel free to move out of session
in case you need to attend an urgent call.
Avoid Disturbance
Avoid unwanted chit chat during the session.
3. 1. Introduction to Event-Driven Architecture (EDA)
Definition of EDA
Key Concepts: Events, Event Publishers, Event Subscribers
Advantages of Event-Driven Architecture
2. Overview of Microservices
Definition of Microservices
Characteristics of Microservices Architecture
Challenges and Solutions
3. Introduction to AxonIQ
What is AxonIQ?
Key Components: Axon Framework and Axon Server
Why Choose Axon for Event-Driven Microservices?
4. Building Event-Driven Microservices with Axon Framework
Setting Up Axon Framework
Defining Aggregates, Events, and Commands
Handling Events and Commands with Axon
5. Benefits of Event-Driven Microservices with AxonIQ
Scalability
Flexibility and Agility
Fault Tolerance
Event Sourcing
6. Best Practices for Event-Driven Microservices
Event-Driven Design Patterns
Command-Query Responsibility Segregation (CQRS)
Event Sourcing Best Practices
Testing Strategies
7. Use Case
4.
5. Definition of EDA
Event-Driven Architecture (EDA) is a design pattern where the flow of the application is determined by events such as user actions, sensor outputs,
or messages from other programs. In this architecture, services communicate through events rather than direct, synchronous requests.
6. Key Concepts
Key Concepts:
− Events: Events are occurrences or state changes in a system that are significant to the business. Examples include user registrations, order
placements, or inventory updates.
− Event Publishers: Components that generate events and publish them to the event bus or broker.
− Event Subscribers: Components that subscribe to specific types of events and react accordingly.
Advantages of EDA:
− Decoupling: Services are loosely coupled, allowing for independent development and scalability.
− Flexibility: New services can be added without affecting existing ones.
− Asynchronous Communication: Enables asynchronous communication between services, improving responsiveness.
8. Characteristics of Microservices
Architecture Challenges
Definition of Microservices
Microservices is an
architectural style where an
application is composed of
small, independent
services, each serving a
specific business capability.
These services
communicate through APIs.
Autonomy: Each
microservice can be
developed, deployed, and
scaled independently.
Single Responsibility:
Each microservice should
focus on a specific business
capability.
Resilience: Failures in one
microservice shouldn't
affect the entire system.
Distributed Data
Management: Use event
sourcing or distributed
databases.
Communication
Complexities: Employ API
gateways and service
discovery mechanisms.
Microservices
10. AxonIQ
What is AxonIQ?:
− AxonIQ is a platform that provides tools and frameworks for building scalable and distributed applications
based on the principles of Event-Driven Architecture.
Key Components:
− Axon Framework: A Java framework that simplifies the development of scalable and distributed
applications using CQRS and event sourcing.
− Axon Server: A dedicated event store and messaging platform.
Why Choose Axon for Event-Driven Microservices?:
− Axon facilitates the implementation of CQRS, allowing for a clearer separation of concerns between
command (write) and query (read) operations.
− It supports event sourcing, providing a historical record of changes to the system's state.
12. Event-Driven Microservices with Axon Framework
Setting Up Axon Framework:
− Project Structure: Organize your project into aggregates, commands, events, and handlers.
− Dependencies: Include Axon dependencies in your project.
Defining Aggregates, Events, and Commands:
− Aggregates: Represent consistency boundaries and encapsulate state changes.
− Events: Represent immutable facts about changes in the system.
− Commands: Represent requests to change the system's state.
Handling Events and Commands with Axon:
− Command Handlers: Process incoming commands.
− Event Handlers: React to events, updating the state or triggering further processes.
14. Benefits of Event-Driven Microservices with AxonIQ
Scalability:
− Events enable horizontal scaling by allowing multiple instances of a service to independently process
events.
Flexibility and Agility:
− Microservices architecture, combined with events, allows for quicker development, deployment, and
adaptation to changing business requirements.
Fault Tolerance:
− Decoupled services and asynchronous communication contribute to fault isolation, preventing the failure
of one service from affecting others.
Event Sourcing:
− Event sourcing provides an auditable and reconstructable history of system state changes, supporting
advanced analytics and debugging.
16. Best Practices for Event-Driven Microservices
Event-Driven Design Patterns:
− Event Sourcing Pattern: Storing the state of an entity as a sequence of events.
− Event-Driven Saga Pattern: Coordinating long-running and distributed transactions.
CQRS (Command-Query Responsibility Segregation):
− Separate the write and read sides of your application to optimize for each operation.
Event Sourcing Best Practices:
− Versioning: Manage changes to events over time.
− Snapshotting: Periodically save and rebuild the state to optimize performance.
Testing Strategies:
− Unit Testing: Test individual components in isolation.
− Integration Testing: Verify the interaction between microservices.
18. Car Demo
We have developed microservices with
Axon Framework. Each microservice solve a
business problem or representing a domain
for example order, product, shipment,
inventory etc.
GitHub