Overview
The Eventing Modeler is based on theIntent.Modelers.Eventing module, which provides:
- Visual modeling of integration messages (events and commands)
- Event handler modeling
- Publish-subscribe patterns
- Message-based integration between services
- Support for message brokers (RabbitMQ, Kafka, Azure Service Bus, etc.)
- Event-driven architecture patterns
Designer Configuration
The Eventing capabilities extend the Services designer with eventing-specific elements:- Module ID:
Intent.Modelers.Eventing - Extends: Services Designer
- Core Types: Integration events, integration commands, event handlers, message subscriptions
What is Message-Based Integration?
Message-based integration is a design approach where systems communicate asynchronously by exchanging messages through a message broker. This approach:- Decouples Systems: Services operate independently without direct dependencies
- Improves Scalability: Components can scale independently
- Enhances Fault Tolerance: Systems remain resilient when services are temporarily unavailable
- Enables Flexibility: Easy to add new services or modify existing ones
- Processing orders asynchronously
- Handling events across microservices
- Coordinating distributed workflows
- Real-time notifications and updates
Core Elements
Message
Messages are the base type for integration events and commands. Properties:- Name: Message name
- Properties: Data fields carried by the message
- Folder: Organization folder
Integration Event
Integration events represent notifications about something that has happened in the system. Characteristics:- Past-tense naming (e.g.,
OrderPlaced,PaymentProcessed) - Published by one service
- Can have multiple subscribers
- Represents a fact that occurred
CustomerRegisteredOrderShippedPaymentFailedInventoryUpdated
Integration Command
Integration commands represent requests to perform an action in another service. Characteristics:- Imperative naming (e.g.,
ProcessPayment,UpdateInventory) - Published by one service
- Typically has one handler
- Represents an intent or request
ProcessPaymentSendNotificationUpdateCustomerDetailsReserveInventory
Event Handler
Event handlers subscribe to and process integration events or commands. Properties:- Name: Handler name
- Subscribed Messages: Events or commands this handler processes
- Operations: Logic to execute when message is received
Message Publish Association
Represents publishing an integration message from a service operation. Usage: Draw an association from a Command/Query to an Integration Event/Command to indicate that the operation publishes that message.Message Subscribe Association
Represents subscribing to an integration message. Usage: Draw an association from an Event Handler to an Integration Event/Command to indicate that the handler subscribes to that message.Modeling Patterns
Publishing Integration Events
When a service operation completes, it can publish an event to notify other services. Steps:- Create an Integration Event (e.g.,
OrderPlaced) - Add properties to the event (OrderId, CustomerId, Total)
- Find the Command that triggers this event (e.g.,
CreateOrder) - Draw a “Publish” association from the Command to the Integration Event
- Optionally configure mapping between command result and event properties
Subscribing to Integration Events
Services can react to events published by other services. Steps:- Create an Event Handler (e.g.,
OrderPlacedHandler) - Create or reference the Integration Event (e.g.,
OrderPlaced) - Draw a “Subscribe” association from the Event Handler to the Integration Event
- Add operations to the handler to define processing logic
Sending Integration Commands
A service can send a command to another service to request an action. Steps:- Create an Integration Command (e.g.,
ProcessPayment) - Add properties (OrderId, Amount, PaymentMethod)
- From a service operation, draw a “Publish” association to the Integration Command
- Create an Event Handler in the target service to process the command
Saga/Workflow Pattern
Coordinate multi-step distributed transactions. Example: Order Processing SagaEvent-Driven Architecture Patterns
Event Notification
Simple notification that something happened. Use Case: Notify systems when data changes Pattern:- Publisher: Emits event with minimal data
- Subscribers: React to event, potentially querying for more details
Event-Carried State Transfer
Events carry complete state data. Use Case: Avoid queries back to source system Pattern:- Publisher: Includes full entity state in event
- Subscribers: Update local cache/replica from event data
Event Sourcing
Store state as sequence of events. Use Case: Audit trail, temporal queries, replay capability Pattern:- Commands generate events
- Events are persisted as source of truth
- Current state derived by replaying events
Metadata API
Accessing Eventing Models
Working with Messages
Working with Event Handlers
Detecting Publish Operations
Integration with Message Brokers
The Eventing Modeler is technology-agnostic, supporting various message brokers through Intent Architect modules:RabbitMQ
- Topic exchanges for events
- Direct exchanges for commands
- Queue configuration
- Retry and dead-letter handling
Azure Service Bus
- Topics for events
- Queues for commands
- Sessions and correlation
- Scheduled messages
Kafka
- Topics for events
- Consumer groups
- Partitioning strategies
- Offset management
Amazon SQS/SNS
- SNS topics for events
- SQS queues for consumers
- Fan-out patterns
Common Modeling Scenarios
Microservice Communication
Scenario: Order Service notifies Inventory Service-
In Order Service designer:
- Create
CreateOrdercommand - Create
OrderPlacedintegration event - Add properties: OrderId, CustomerId, Items[]
- Link command to publish event
- Create
-
In Inventory Service designer:
- Reference or create
OrderPlacedevent - Create
OrderPlacedHandlerevent handler - Subscribe handler to event
- Add
UpdateInventoryoperation to handler
- Reference or create
Distributed Transaction
Scenario: Payment processing workflow-
Create events:
PaymentRequestedPaymentProcessedPaymentFailed
-
Create commands:
ProcessPaymentRefundPayment
-
Create handlers:
PaymentRequestedHandler→ SendsProcessPaymentPaymentProcessedHandler→ Updates order statusPaymentFailedHandler→ Triggers compensation
Event Fan-Out
Scenario: Single event, multiple handlers- Create event:
CustomerRegistered - Create multiple handlers:
SendWelcomeEmailHandlerCreateLoyaltyAccountHandlerUpdateAnalyticsHandler
- Subscribe all handlers to the same event
Integration with Modules
The Eventing Modeler integrates with:- MassTransit Module: Generate MassTransit-based messaging
- NServiceBus Module: Generate NServiceBus endpoints and handlers
- Azure Service Bus Module: Generate Azure Service Bus clients
- RabbitMQ Module: Generate RabbitMQ consumers and publishers
- Event Sourcing Modules: Generate event sourcing infrastructure
Best Practices
- Event Naming: Use past-tense for events (e.g.,
OrderPlaced), imperative for commands (e.g.,PlaceOrder) - Event Schema: Include essential data in events; avoid excessive payloads
- Idempotency: Design handlers to be idempotent (safe to process multiple times)
- Versioning: Plan for event schema evolution from the start
- Error Handling: Model compensation events for saga rollback
- Correlation: Include correlation IDs to trace distributed workflows
- Documentation: Add comments explaining event semantics and expected handlers
- Boundaries: Keep integration events at bounded context boundaries
- Granularity: Events should represent meaningful business facts
- Testing: Model both happy path and failure scenarios
Example Eventing Model
A typical e-commerce eventing model:Related Resources
- Services Modeler - Model commands and queries that publish events
- Domain Modeler - Model domain events within aggregates
- Message-Based Integration Documentation