Prompt
How do I stream real-time events between microservices without using batch jobs?
Latest observation
Oct 24, 2026
OpenAI APIWeb search: off
To stream real-time events between microservices without batch jobs, use event-driven architecture with a message broker / event bus instead of scheduled polling or bulk transfers.
Core idea
- A service produces an event when something meaningful happens.
- The event is sent immediately to a broker.
- Other services subscribe and react in near real time.
Common building blocks
- Event producers: microservices that publish events
- Event broker / stream platform: Kafka, RabbitMQ, NATS, Pulsar, AWS SNS/SQS, Google Pub/Sub, Azure Service Bus/Event Hubs
- Event consumers: microservices that process events as they arrive
Typical flow
Example:
OrderServicecreates an order- It publishes
OrderCreated InventoryService,PaymentService, andNotificationServiceconsume that event independently
Good patterns to use
1. Publish/Subscribe
Best for broadcasting events to multiple services.
2. Event streaming
Best when you need ordered, durable streams and replay capability, e.g. Kafka.
3. Command + event separation
- Commands: “do this”
- Events: “this happened”
4. Outbox pattern
Use this if a service writes to a database and publishes an event at the same time.
It prevents losing events if the DB commit succeeds but message publish fails.
Important design practices
- Make events immutable
- Include:
- event type
- event ID
- timestamp
- aggregate/entity ID
- version/schema info
- Design consumers to be idempotent because duplicate delivery can happen
- Use retries, dead-letter queues, and backoff
- Keep messages small; put large payloads in object storage and send a reference if needed
- Version your event schema carefully
- Monitor lag, throughput, failures, and consumer offsets
Example architecture
Service A --> Event Broker --> Service B
\------> Service C
\------> Service D
If you want low latency
Use a broker that supports persistent connections and push-based delivery:
- Kafka for high-throughput event streams
- NATS for lightweight low-latency messaging
- RabbitMQ for flexible routing
- Pub/Sub services in cloud environments for managed scaling
What to avoid
- Polling databases from other services
- Batch synchronization jobs for “real-time” needs
- Tight synchronous coupling for everything
Recommended starting point
If you’re unsure:
- Use Kafka if you need durable event streams, replay, and scale
- Use RabbitMQ/NATS if you need simpler service-to-service messaging
- Add the outbox pattern if events must not be lost
If you want, I can also show:
- a reference architecture diagram,
- an example in Kafka/RabbitMQ, or
- how to implement this in Spring Boot, Node.js, or .NET.