Event-driven design trade-offs: decoupling and temporal independence vs hidden flows, eventual consistency, ordering, duplicates and schema evolution; notification vs state-carried events; choreography vs orchestration; and keeping it observable on Azure.
Events simplify a system when the producer shouldn't know who reacts: an OrderPlaced that triggers email, loyalty, analytics and fulfilment, each owned by a different team, each able to be down without stopping checkout, and with spikes absorbed by a queue. They hide complexity when a business process becomes an invisible chain of handlers โ nobody can say where an order is, failures disappear into dead-letter queues, and changing the flow means editing five services. I keep direct calls when the caller needs the answer now, use choreography for independent reactions and orchestration (a saga or Durable Functions) for processes with steps and compensations. Non-negotiables: outbox, idempotent consumers, ordering per key, versioned schemas and trace context through messages. The trade-off: decoupling in time and ownership in exchange for eventual consistency and harder debugging.
"I'd start by separating two things events give you. One is temporal decoupling: the producer doesn't wait, so checkout keeps working when the loyalty service is down and a spike becomes a queue instead of an outage. The other is ownership decoupling: the producer doesn't know who reacts, so a new team can subscribe to
OrderPlacedwithout changing the order service. When you need both, events are a big simplification. When you need neither โ the caller needs the answer now, or there's exactly one consumer that's really the next step of the same process โ events just add a broker, a delay and a debugging problem.The trap is the long choreographed chain. For example, at [company] we [had an order flow where Order published, Payment reacted, then Stock, then Shipping, each listening for the previous event]. Nobody owned the whole process, so when [orders got stuck] support couldn't tell where, and a change to the flow meant touching four services. I [replaced the chain with an orchestrated saga in the order service that sends commands and tracks state, while keeping events for the genuinely independent reactions like email and analytics], [and stuck-order investigations went from hours to a query]. That's my rule: choreography for independent reactions, orchestration when there's a process with an order, timeouts and compensations.
The mistake I see is adopting events without the plumbing that makes them safe: no outbox so events get lost, consumers that aren't idempotent so duplicates double-charge, no ordering per entity, no schema versioning, and no trace context, so the application map shows nothing. On Azure I use Service Bus for business events and commands, Event Grid for reactive notifications like blob-created, and Event Hubs only for high-volume streams. Events are a great way to decouple teams and time, and a terrible way to hide a process nobody owns."
| Signal | Events help | Events hurt |
|---|---|---|
| Consumers | Many, independent, owned by other teams | One, and it's the next step of the same process |
| Caller needs a result | No (fire and forget) | Yes, now (price, stock, auth) |
| Availability | Producer must keep working when consumers fail | Process is useless unless every step succeeds now |
| Load | Spiky; consumers can catch up | Steady, low, latency-sensitive |
| Process visibility | Reactions are independent | Business needs to know where each instance is |
| Team maturity | Outbox, idempotency, tracing in place | None of that exists yet |
| Kind | Payload | Consumer behaviour | Risk |
|---|---|---|---|
| Notification | Id + type (OrderPlaced { orderId }) |
Calls back for details | Callback load, coupling at read time |
| Event-carried state transfer | Full state needed | Keeps a local copy | Schema coupling, large messages, PII spread |
| Domain event | In-process, inside a bounded context | Same transaction or right after | Leaking internal models if published |
| Integration event | Cross-service, versioned contract | Async, at least once | Versioning discipline |
| Need | Azure | AWS note |
|---|---|---|
| Business events and commands, ordering, sessions, DLQ | Service Bus (queues, topics) | SQS / SNS, EventBridge |
| Reactive notifications from Azure resources or apps | Event Grid | EventBridge |
| High-volume telemetry / streams, replay | Event Hubs (Kafka protocol) | Kinesis, MSK |
| Orchestration | Durable Functions, MassTransit / NServiceBus sagas | Step Functions |
Moving five independent post-order reactions to a Service Bus topic cut checkout p95 from [1.4 s] to [380 ms] and kept checkout available through [two] loyalty outages. Replacing the choreographed paymentโstockโshipping chain with an orchestrated saga reduced stuck orders found by customers from [~25] a week to [2], because the saga's timeouts raised them first.
Checks whether the candidate can judge where events help and where they hide complexity, and whether they know the mechanisms that make event-driven systems reliable and debuggable.
Green flags
Red flags
Synchronous: checkout --HTTP--> loyalty (checkout fails if loyalty is down)
Event-driven: checkout --OrderPlaced--> [topic] --> loyalty (catches up later)
\--> email
\-> analytics
Events remove temporal coupling (both up at the same time) and knowledge coupling (producer knows consumers). They keep schema coupling: every consumer depends on the event contract, which is now a public API.
Choreography: Order -> (OrderPlaced) -> Payment -> (PaymentTaken) -> Stock -> (StockAllocated) -> Shipping
no one knows the whole flow; state is spread across services
Orchestration: OrderSaga --PayCommand--> Payment
OrderSaga <--PaymentTaken--
OrderSaga --AllocateCommand--> Stock (state + timeouts in one place)
Rule of thumb: if you need to answer "where is order 123 and why is it stuck?", you want an orchestrator with persisted state.
| Problem | Mechanism |
|---|---|
| Event lost when the process crashes after commit | Transactional outbox, relay to the broker |
| Duplicate delivery (at-least-once) | Idempotent consumer: processed-message table keyed by message id, or natural idempotency |
| Out-of-order processing | Partition / session by entity id (Service Bus SessionId), version numbers |
| Poison messages | Max delivery count โ dead-letter queue, alerting, a replay tool |
| Schema change | Additive changes only, version in the type name (OrderPlaced.v2), tolerant readers |
| Invisible flows | W3C traceparent in message properties, OpenTelemetry instrumentation of the Service Bus SDK, AsyncAPI catalogue |
Ask of any event-driven design:
Event-driven communication between services is not event sourcing (storing an entity's state as its events). You can have either without the other; combining them by default doubles the learning curve.
Azure.Messaging.ServiceBus and check the Application Insights application map shows producer โ consumer.An idempotent Service Bus consumer that keeps trace context, so an event-driven flow stays safe and visible.
namespace Loyalty.Consumers;
using Azure.Messaging.ServiceBus;
using Microsoft.EntityFrameworkCore;
public sealed record OrderPlaced(Guid OrderId, Guid CustomerId, decimal Total, int Version);
public sealed class ProcessedMessage
{
public required string MessageId { get; init; } // unique index: a duplicate insert fails
public DateTimeOffset ProcessedAt { get; init; } = DateTimeOffset.UtcNow;
}
public sealed class OrderPlacedConsumer(ServiceBusClient client, IServiceScopeFactory scopes,
ILogger<OrderPlacedConsumer> logger) : BackgroundService
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
// Sessions keyed by CustomerId keep one customer's events in order.
await using var processor = client.CreateSessionProcessor("orders", "loyalty",
new ServiceBusSessionProcessorOptions { MaxConcurrentSessions = 16, AutoCompleteMessages = false });
processor.ProcessMessageAsync += HandleAsync;
processor.ProcessErrorAsync += e =>
{
// Called for any exception thrown by HandleAsync, and for connection errors.
logger.LogError(e.Exception, "Service Bus error on {Entity} ({Source})", e.EntityPath, e.ErrorSource);
return Task.CompletedTask;
};
await processor.StartProcessingAsync(stoppingToken);
try { await Task.Delay(Timeout.Infinite, stoppingToken); }
catch (OperationCanceledException) { }
await processor.StopProcessingAsync(CancellationToken.None);
}
private async Task HandleAsync(ProcessSessionMessageEventArgs args)
{
// The SDK propagates W3C trace context through Diagnostic-Id, so this span links to the producer.
var evt = args.Message.Body.ToObjectFromJson<OrderPlaced>()!;
await using var scope = scopes.CreateAsyncScope();
var db = scope.ServiceProvider.GetRequiredService<LoyaltyDbContext>();
await using var tx = await db.Database.BeginTransactionAsync(args.CancellationToken);
db.Processed.Add(new ProcessedMessage { MessageId = args.Message.MessageId });
db.Points.Add(new PointsEntry(evt.CustomerId, evt.OrderId, (int)evt.Total));
try
{
await db.SaveChangesAsync(args.CancellationToken); // effect + dedup record commit together
await tx.CommitAsync(args.CancellationToken);
}
catch (DbUpdateException) when (await IsDuplicateAsync(args.Message.MessageId, args.CancellationToken))
{
// Already processed (duplicate delivery): safe to complete.
logger.LogInformation("Duplicate {MessageId} ignored", args.Message.MessageId);
}
// Any other exception is not caught on purpose: the processor reports it to ProcessErrorAsync and
// abandons the message, so it is retried and, after MaxDeliveryCount attempts, dead-lettered.
// Nothing fails silently โ alert on dead-letter queue depth.
await args.CompleteMessageAsync(args.Message, args.CancellationToken);
}
private async Task<bool> IsDuplicateAsync(string messageId, CancellationToken ct)
{
// Fresh scope: the failed DbContext still tracks the rejected entities.
await using var scope = scopes.CreateAsyncScope();
var db = scope.ServiceProvider.GetRequiredService<LoyaltyDbContext>();
return await db.Processed.AsNoTracking().AnyAsync(p => p.MessageId == messageId, ct);
}
}
Events are an organisational tool as much as a technical one: they let teams evolve independently. The senior judgement is to use them where independence is valuable, and to keep a visible owner for every business process. Before going event-driven, check the team has the plumbing: outbox, idempotency, DLQ alerting, tracing and schema governance. Without them, events turn bugs into silent data drift.
| Style | When it fits | Cost | When not to |
|---|---|---|---|
| Direct call (HTTP/gRPC) | Caller needs an answer now | Temporal coupling, cascading failure | Fan-out to many independent consumers |
| Choreographed events | Independent reactions, many teams | Hidden flows, harder debugging | Multi-step process with compensations |
| Orchestrated saga | Ordered process, timeouts, compensations | Orchestrator to build and run | Simple notifications |
| Event streaming (Event Hubs/Kafka) | High volume, replay, analytics | Ops, partition management | Low-volume business workflows |
A domain event records something meaningful that happened inside one bounded context, such as OrderPlaced. It is raised by an aggregate, handled in-process by other parts of the same model, and uses domain types freely. An integration event is a published contract for other services or modules: serialised, versioned and owned by the publisher.
SaveChanges), so their side effects commit or roll back together.The trade-off: domain events give you strong consistency in one context; integration events give you decoupling at the cost of eventual consistency and at-least-once delivery.
I model the order as an explicit state machine owned by the Order service, with Payment, Inventory, Fulfilment and Shipping each owning their own data. Services communicate with events and commands over Azure Service Bus, published through a transactional outbox so a state change and its event commit together. The multi-step flow is an orchestrated saga: the Order service sends commands, waits for replies, applies timeouts, and runs compensations (void the payment, release stock) when a step fails. Delivery is at-least-once, so every consumer is idempotent, and sessions keyed by OrderId keep one order's messages in order. Customer service reads a tracking projection built from the events. The trade-off: no distributed transactions means eventual consistency, so you design for stuck and out-of-order states explicitly.
Event sourcing stores every state change as an immutable event in an append-only stream per aggregate, and derives current state by replaying those events. The event log is the source of truth; tables you query are projections built from it. Appends use the expected stream version for optimistic concurrency. Snapshots speed up replay for long streams, and events are evolved by additive changes and upcasting, never by editing history.
It's worth it when the history itself is valuable: audit, temporal queries ("what did we know on 1 July?"), complex behaviour. It's a poor fit for CRUD and for teams new to it, because you pay in eventual consistency, schema evolution and harder queries.
How to tell it (STAR)
**S:** Our order flow was a chain of services reacting to each other's events, and orders kept getting stuck where nobody could see them. **T:** I was asked to make the flow reliable and supportable. **A:** I traced stuck orders, found dead-lettered messages and out-of-order drops, replayed them and added alerts; then I moved the core process into an orchestrated saga with timeouts and kept events for independent reactions like email. **R:** Customer-found stuck orders went from [~25] a week to [2], and support could answer 'where is my order' with one query.
Last updated 23 Nov 2026.