examples: v2.2 event-injection demos for jobs[-ts/-java] - #1058
Conversation
Adds event-aware-provider + event-aware-consumer pairs across Python, TypeScript, Java demonstrating recv_event / send_event / post_event / subscribe_events. Augments the existing Phase 1 examples; refreshes the "What's NOT in Phase 1" section to reflect v2.2. Closes #1057 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (17)
📝 WalkthroughWalkthroughThis PR adds Phase 2 event-injection examples across Python, TypeScript, and Java runtimes, demonstrating end-to-end MeshJob event-draining workflows. Each language pair includes a provider agent that long-polls for work/stop events and a consumer agent that posts events and subscribes to event streams. README documentation is updated to describe the new Phase 2 flow and revised feature gaps. ChangesEvent-Aware Job Examples (v2.2)
Sequence DiagramsequenceDiagram
participant Consumer as Consumer Agent
participant Registry as Registry
participant Provider as Provider Agent
Consumer->>Registry: submit event_aware_long_task job
Consumer->>Consumer: start event subscription (work events)
Consumer->>Provider: post work event
Provider->>Provider: recvEvent (work)
Provider->>Provider: increment counter
Consumer->>Provider: post work event
Provider->>Provider: recvEvent (work)
Consumer->>Provider: post work event
Provider->>Provider: recvEvent (work)
Consumer->>Provider: post stop event
Provider->>Provider: recvEvent (stop)
Provider->>Provider: complete job with result
Consumer->>Consumer: await job result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
## Summary Release v2.2.0 — the MeshJob event-injection wave. Rolls up six feature PRs (cross-runtime point-to-point event injection + stream subscription) plus three docs/examples PRs into a stable release: - **MeshJob event injection** — `recv_event` / `send_event` / `post_event` across Python (#1041), TypeScript (#1043), Java (#1045). - **MeshJob stream subscription** — `subscribe_events` async generator (Python #1047, TS #1049) and `EventSubscription` Closeable iterator (Java #1051). - **Docs + examples** — concepts + env vars + meshctl man + release notes (#1053), signature-drift follow-up (#1056), runnable event-injection example agents across all three runtimes (#1058). See `RELEASE_NOTES.md` for the per-feature narrative grouping all six feature PRs. ## Mechanical changes in this PR - `scripts/bump_version.py 2.1.0 2.2.0` — 417 files updated across 36 categories (Cargo manifests, pyproject.toml, package.json, helm charts, scaffold templates, man content, test config, release workflow versions). - `helm dependency update helm/mcp-mesh-core` — Chart.lock regenerated. - `cargo generate-lockfile` (src/runtime/core) — Cargo.lock refreshed. - `RELEASE_NOTES.md` — `## v2.2.0 (UNRELEASED)` → `## v2.2.0 (2026-05-19)`, top-of-file Full Changelog link bumped to `v2.2.0...HEAD`, new `v2.1.0...v2.2.0` link added above the v2.2.0 heading. Net diff: 398 files changed, +613 / -611. Mostly one-line version bumps. Closes #1059 ## Test plan - [x] Dry-run `bump_version.py` matched expected scope (537 files / 36 categories) - [x] No stray `2.1.0` mcp-mesh-internal references left after bump (sanity grep — only transitive npm-dep matches remain) - [x] `helm dependency update` + `cargo generate-lockfile` reminders followed - [x] All upstream feature PRs (#1041 → #1058) merged and validated end-to-end before this release was cut - [ ] **After merge**: tag `v2.2.0` pushed to origin (HOLD for user inspection of merged main) - [ ] **After tag**: publish workflow fired (HOLD for explicit user go-ahead) Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Summary
Adds 6 runnable agent directories (2 per runtime:
event-aware-provider+event-aware-consumer) under the existingexamples/jobs/(Python),examples/jobs-ts/,examples/jobs-java/Phase 1 example trees. Demonstrates the v2.2 MeshJob event-injection surface end-to-end:task=Truecapability): loops onrecv_event(types=["work", "stop"]), processes work events, returns{processed: N, status: "stopped"}when astopevent arrives.subscribe_eventsobserver that mirrors events to logs, posts 3workevents + 1stopevent viapost_event, awaits result. Returns{job_id, posted_seqs, observed_count, observed_events, result}. Java additionally returnssubscriber_status.Each runtime's pair was generated with
meshctl scaffold basic --no-interactive(per project convention — don't hand-write boilerplate) and then trimmed to match the Phase 1 file convention (no Dockerfile / helm-values).All three pairs validated end-to-end against locally-built binaries: Python (4s), TypeScript (4s), Java (3s) — each returning the expected JSON shape.
The pre-existing "What's NOT in Phase 1" sections in the three READMEs (which previously claimed events were not yet shipped) have been refreshed to "What's NOT in v2.2 yet".
Review Notes
Independent review caught 7 WARNINGs (0 BLOCKERs). Addressed:
subscriber.cancel()now followed byawait subscriberwithCancelledErrorswallow. Avoids "Task was destroyed but it is pending!" GC warning../bin/mcp-mesh-registry, with amake buildnote. (Phase 1 sections preserved as-is.)max(.., 1)clamp ×3 runtimes —processed / max(processed+1, 1)simplified toprocessed / (processed+1)in all 3 provider files. The clamp was dead code (processed ≥ 0 ⇒ processed+1 ≥ 1).EventSubscription.close()) — documented honestly in source comments. JS has no cancellation primitive withoutAbortControllerplumbing through napi; Java'sclose()flips a volatile flag but doesn't interrupt in-flight FFI long-polls. Plumbing true interruption is out of scope for example code.proxy.close()may stall on subscriber tail — added one-line comment explaining the shared-cached-proxy + write-lock interaction with the in-flight subscriber's read-lockedlistEventscall.Skipped with reason:
index.tsflat vs Phase 2src/index.ts+tsconfig.json) —meshctl scaffoldoutput is the modern Node convention; trimming Phase 2 to match Phase 1's older flat layout would actively make it worse for users. Phase 1 is the outlier; uplift is out of scope here.application.ymlvs Phase 1'sapplication.properties— same reasoning. Scaffold output, modern Spring Boot convention.Closes #1057
Test plan
subscriber_status: "ok", ~3s./bin/mcp-mesh-registryregistry-start command in their Phase 2 sectionsBuild prerequisites for runners
The examples assume the user has run
make buildat the repo root once (producesbin/mcp-mesh-registry,bin/meshctl, and the per-runtime SDK artifacts). Per-language additionally:mcp-mesh-coreeditable install viamaturin develop --releasefromsrc/runtime/core/.make build-rust-core(napi binding) +npm installin each agent dir.mvn install -DskipTests -pl mcp-mesh-core,mcp-mesh-sdk -amplusMESH_NATIVE_LIB_PATHpointing to a directory containing an FFI-onlylibmcp_mesh_core.dylib(built viaCARGO_TARGET_DIR=target/ffi cargo build --no-default-features --features ffi --releasefromsrc/runtime/core/). The default cargo build includes the Python feature which Java cannot load.Summary by CodeRabbit
Release Notes
New Features
Documentation