这是indexloc提供的服务,不要输入任何密码
Skip to content

v0.1.42

Compare
Choose a tag to compare
@Raezil Raezil released this 26 Apr 18:48
· 23 commits to main since this release

Release Notes

GoEventBus v0.1.42 — 2025-04-26

🎉 New Features

  • Transactional API
    • Added Transaction type on EventStore
    • BeginTransaction() to start buffering events
    • Publish(Event) on a Transaction to collect multiple events
    • Commit(ctx) atomically enqueues and immediately processes all buffered events, returning the first error (from subscribe or handler)
    • Rollback() to discard buffered events without side-effects

🧪 Testing

  • Unit tests covering:
    • Successful commit of multiple events
    • Rollback semantics (no events processed)
    • Partial-failure handling (handler errors abort the transaction)
  • Benchmarks for 16-event transactions under both sync and async modes to measure throughput and latency

⚙️ Internals & Improvements

  • Synchronous commit now processes events in-ring (bypassing external es.Publish) to ensure atomicity
  • First handler error aborts remaining work and advances tail to drop unprocessed entries
  • Transaction buffer cleared after commit, avoiding duplicate dispatch

📝 Migration Notes

  • Replace manual enqueuing + es.Publish() with:
    tx := es.BeginTransaction()
    // … tx.Publish(…)
    err := tx.Commit(ctx)