# Event Driven Architecture

> Best practices for Kafka/RabbitMQ message brokering and event sourcing.

- Skill: `j4flmao/event-driven-architecture` (Agent Skill)
- Install (CLI): `npx skillmds@latest add j4flmao/event-driven-architecture`
- Raw SKILL.md: https://api.skillmd.com/api/skills/j4flmao/event-driven-architecture/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: j4flmao (https://skillmd.com/u/j4flmao)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/j4flmao/event-driven-architecture

---


# Event Driven Architecture

## Core Concepts
- **Message Brokering**: Decouples producers and consumers.
- **Event Sourcing**: State is determined by a sequence of events.

## Diagram
```mermaid
%%{init: {"theme": "default", "flowchart": {"useMaxWidth": true}}}%%
flowchart TD
    A[Producer] --> B(Message Broker)
    B --> C[Consumer 1]
    B --> D[Consumer 2]
    B --> E[(Event Store)]
```

## Go Example (Kafka Producer)
```go
package main

import (
    "github.com/confluentinc/confluent-kafka-go/kafka"
    "log"
)

func produceEvent(topic, message string) {
    p, _ := kafka.NewProducer(&kafka.ConfigMap{"bootstrap.servers": "localhost"})
    defer p.Close()

    p.Produce(&kafka.Message{
        TopicPartition: kafka.TopicPartition{Topic: &topic, Partition: kafka.PartitionAny},
        Value:          []byte(message),
    }, nil)
    p.Flush(15 * 1000)
    log.Println("Event produced")
}
```

