Skip to content

feat: add Jev-aware scheduling - #25

Merged
Raezil merged 7 commits into
mainfrom
feat/jev-scheduling
Oct 4, 2026
Merged

Raezil merged 7 commits into
mainfrom
feat/jev-scheduling

Conversation

@Raezil

@Raezil Raezil commented Oct 4, 2026

Copy link
Copy Markdown
Member

Summary

Integrate the existing Rules / Cache / Jev event-selection layer with Schedule and ScheduleAfter without breaking their current signatures.

New API

decision, timer, err := store.DecideAndSchedule(
    ctx,
    time.Now().Add(10*time.Second),
    selector,
    state,
    event,
    candidates,
)

and:

decision, timer, err := store.DecideAndScheduleAfter(
    ctx,
    30*time.Second,
    selector,
    state,
    event,
    candidates,
)

selector can be JevSelector, RuleCacheSelector, or any custom EventSelector.

Semantics

  • event selection happens immediately when scheduling is requested
  • the selected projection is fixed before the timer is created
  • selection errors return immediately and no timer is created
  • handlers do not run until the timer fires
  • past times and non-positive durations preserve existing immediate-execution behavior and return a nil timer
  • existing Schedule / ScheduleAfter APIs are unchanged
  • scheduling remains local even when Redis/RabbitMQ is configured on the parent EventStore

Flow

state
  ↓
Rules
  ↓
Cache
  ↓
Jev
  ↓
selected event
  ↓
timer
  ↓
Subscribe → Publish → handler

Tests

Adds coverage for:

  • real JevSelector scheduling via an httptest Decisions API
  • selected projection propagation
  • no early handler execution before the timer
  • immediate execution for past/non-positive schedules
  • failed selection creating no timer

Docs / examples

  • README scheduling guide updated
  • website scheduling docs updated
  • API reference updated
  • new examples/schedule_jev
  • examples index updated

@vercel

vercel Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
goeventbus Ready Ready Preview Oct 4, 2026 4:28pm UTC
goeventbus-website Ready Ready Preview Oct 4, 2026 4:28pm UTC

@Raezil
Raezil merged commit 97a1954 into main Oct 4, 2026
6 checks passed

This branch was successfully deployed

2 active deployments
Preview – goeventbus-website — e81de82b Deployed Oct 4, 2026 by vercel[bot]
Preview – goeventbus — e81de82b Deployed Oct 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant