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

Releases: Raezil/GoEventBus

v0.1.46

14 Jul 10:05
Compare
Choose a tag to compare
fix gofmt

v0.1.45

30 Apr 16:57
Compare
Choose a tag to compare
feat: replace unsafe.Pointer to atomic.Pointer[Event]

v0.1.44

26 Apr 19:07
Compare
Choose a tag to compare
Update

v0.1.42

26 Apr 18:48
Compare
Choose a tag to compare

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)

v0.1.41

26 Apr 07:52
Compare
Choose a tag to compare

Release Notes (v0.1.41, 2025-04-26)

Welcome to the inaugural April 2025 release of GoEventBus, your in-process, lock-free event bus for Go. This version delivers a major overhaul—with context-aware handlers, flexible back-pressure, observability, and async support—designed to power low-latency pipelines, microservices, and game loops.

Highlights

  • Context-Aware Handlers
    Every event handler now receives a context.Context, unlocking deadlines, cancellation, and tracing for your event-driven workflows.

  • Lock-Free Ring Buffer
    Under the hood is a cache-aligned, atomic ring buffer that dispatches events without locks or syscalls—delivering sub-microsecond hand-offs and zero garbage.

  • Configurable Overrun Policies
    Choose how to handle a full buffer with three strategies:

    • DropOldest (default): discard the oldest events to make room
    • Block: back-pressure until space becomes available
    • ReturnError: fail fast with ErrBufferFull for explicit retry logic
  • Async or Sync Processing
    Flip the Async flag to switch between inline, predictable dispatch or massive parallelism via a worker pool sized to your CPU count.

  • Middleware & Hooks
    Introduce cross-cutting behavior with middleware chains, and tap into execution with before-, after-, and error-hooks for observability and instrumentation.

  • Built-In Metrics
    Track total published, processed, and errored events directly via Metrics(), without additional instrumentation.

  • Zero Dependencies
    Drop-in import (github.com/Raezil/GoEventBus), no brokers to manage—just Go 1.21+ and you’re off.


Changelog

v0.1.41 (2025-04-26)

🚀 Added

  • New context.Context support for all handlers to enable cancellation, timeouts, and tracing.
  • Lock-free ring buffer implementation with cache-line padding for minimal latency.
  • Overrun policies: DropOldest, Block, and ReturnError for flexible back-pressure strategies.
  • Async flag on EventStore to toggle between synchronous and asynchronous dispatch.
  • Middleware support via Use(mw Middleware) to wrap handlers.
  • Hooks:
    • OnBefore (before handler execution)
    • OnAfter (after handler execution)
    • OnError (on handler error)
  • Worker pool sized to runtime.NumCPU() for async processing when Async=true.
  • Metrics() method exposing publishedCount, processedCount, and errorCount.
  • Drain(ctx) and Close(ctx) for graceful shutdown of async workers.

🔧 Changed

  • Default back-pressure policy remains DropOldest to preserve prior behavior.
  • Improved API ergonomics: event IDs and projections are explicit in the Event struct.
  • Internal buffer size validation now panics if not a power of two.

🐞 Fixed

  • Corrected atomic indexing in Subscribe to prevent rare race conditions under extreme load.
  • Ensured Publish skips nil slots to avoid spurious dispatch attempts.

🗑️ Removed

  • Deprecated previous no-context handler signature (fully replaced by HandlerFunc).