<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Messaging on Devops Monk</title><link>https://devops-monk.com/tags/messaging/</link><description>Recent content in Messaging on Devops Monk</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sun, 03 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://devops-monk.com/tags/messaging/index.xml" rel="self" type="application/rss+xml"/><item><title>Event-Driven Spring Boot: Transactional Outbox Pattern with Kafka</title><link>https://devops-monk.com/2026/05/spring-boot-kafka-transactional-outbox/</link><pubDate>Sun, 03 May 2026 00:00:00 +0000</pubDate><guid>https://devops-monk.com/2026/05/spring-boot-kafka-transactional-outbox/</guid><description>Publishing an event to Kafka after saving to the database looks simple. It has a subtle, dangerous flaw: if the Kafka publish fails after the DB commit, or the app crashes between the two, your event is lost and your data is inconsistent.
The Transactional Outbox Pattern solves this by writing the event to the database in the same transaction as the business data, then publishing to Kafka separately. This guide covers the pattern, the implementation, and idempotent consumers.</description></item><item><title>Introduction to Messaging with Apache Kafka</title><link>https://devops-monk.com/tutorials/spring-boot/spring-boot-kafka-introduction/</link><pubDate>Sun, 03 May 2026 00:00:00 +0000</pubDate><guid>https://devops-monk.com/tutorials/spring-boot/spring-boot-kafka-introduction/</guid><description>REST APIs are synchronous — the caller waits for a response. Sometimes you don&amp;rsquo;t want that. An order creation shouldn&amp;rsquo;t wait for the inventory system, the notification system, and the analytics system to all respond before confirming to the user. Kafka decouples these concerns.
What Kafka Is Kafka is a distributed event streaming platform. It stores events (messages) in an ordered, immutable log. Producers write to Kafka; consumers read from it.</description></item><item><title>Producing and Consuming Kafka Messages</title><link>https://devops-monk.com/tutorials/spring-boot/spring-boot-kafka-producer-consumer/</link><pubDate>Sun, 03 May 2026 00:00:00 +0000</pubDate><guid>https://devops-monk.com/tutorials/spring-boot/spring-boot-kafka-producer-consumer/</guid><description>This article implements Kafka producers and consumers with the full production setup — error handling, retries, dead-letter topics, and idempotent consumers.
Producer: KafkaTemplate @Service @RequiredArgsConstructor @Slf4j public class OrderEventPublisher { private final KafkaTemplate&amp;lt;String, Object&amp;gt; kafkaTemplate; public void publishOrderCreated(Order order) { OrderCreatedEvent event = new OrderCreatedEvent( order.getId(), order.getCustomerId(), order.getCustomerEmail(), order.getItems().stream().map(OrderItemDto::from).toList(), order.getTotalAmount(), Instant.now() ); // Key = customerId: all events for same customer go to same partition kafkaTemplate.send(&amp;#34;order-events&amp;#34;, order.getCustomerId().toString(), event) .whenComplete((result, ex) -&amp;gt; { if (ex !</description></item><item><title>Reliable Event Publishing: The Transactional Outbox Pattern</title><link>https://devops-monk.com/tutorials/spring-boot/spring-boot-kafka-outbox-pattern/</link><pubDate>Sun, 03 May 2026 00:00:00 +0000</pubDate><guid>https://devops-monk.com/tutorials/spring-boot/spring-boot-kafka-outbox-pattern/</guid><description>There is a fundamental problem with publishing Kafka events after a database commit: if the application crashes between the commit and the publish, the event is lost forever. The Transactional Outbox Pattern solves this.
The Problem @Transactional public Order createOrder(CreateOrderRequest request) { Order order = orderRepository.save(buildOrder(request)); // DB committed ✓ kafkaTemplate.send(&amp;#34;order-events&amp;#34;, event); // ← Crash here → event lost, DB already committed // → Inventory never updated, customer never notified return order; } Two distributed systems (PostgreSQL and Kafka) can&amp;rsquo;t be in a single transaction.</description></item></channel></rss>