Event-driven architecture

이벤트 주도 아키텍처

Producers publish state changes and consumers react independently.

···
html
<div class="scene"><div class="title">ORDER PLACED</div><div class="row event"><div class="tile">ORDER</div><div class="stem">→</div><div class="tile pulse">EVENT</div><div class="fork"><div id="billing" class="tile">BILLING</div><div id="notify" class="tile">NOTIFY</div></div></div><div id="eventState" class="muted">Subscribers process independently</div></div>
css
.scene{width:min(94vw,760px);height:min(86vh,320px);padding:clamp(10px,2.5vmin,18px);border:1px solid var(--line);border-radius:14px;background:var(--surface);color:var(--fg);font:500 clamp(11px,1.3vw,16px)/1.25 "Pretendard Variable",Pretendard,-apple-system,sans-serif;display:flex;flex-direction:column;gap:clamp(7px,1.6vmin,12px);overflow:hidden}.scene *{box-sizing:border-box}.title{font-weight:750;color:var(--accent)}.muted{color:var(--muted)}.mono{font-family:ui-monospace,monospace}.row{display:flex;align-items:center;justify-content:center;gap:clamp(5px,1.4vmin,12px);flex:1;min-height:0}.tile{border:1px solid var(--line);border-radius:8px;background:var(--bg);padding:clamp(6px,1.6vmin,12px);text-align:center;min-width:0}.on{border-color:var(--accent)!important;background:color-mix(in srgb,var(--accent) 12%,var(--surface))!important}.pulse{animation:pulse 1.6s infinite alternate}@keyframes pulse{to{border-color:var(--accent);transform:translateY(-3px)}}.event .tile{min-width:22%}.stem{color:var(--accent)}.fork{display:grid;gap:10px;flex:1}.fork .tile{text-align:left}.fork .tile:before{content:"↳ ";color:var(--accent)}
js
let phase=0;function tick(){document.getElementById('billing').classList.toggle('on',phase%3!==2);document.getElementById('notify').classList.toggle('on',phase%3===2);document.getElementById('eventState').textContent=phase%3===2?'Notification handled later':'Billing handles its copy';phase++}tick();setInterval(tick,850)

In an event-driven system, a producer publishes a fact and subscribers perform their own work. The producer need not know when or how consumers run.

In the demo one order event fans out to Billing and Notifications at different times. Duplicates, ordering, and retries need explicit handling.

When to use

Use it when several capabilities must react independently to one change.

Open as page ↗