Summary
Extend the Java SDK with MeshJob event-injection parity following the Python (#1041) and TypeScript (#1043) verticals already shipped for issue #1032.
Completes the original MeshJob cross-runtime shipping pattern: Python (#861/#878) → TypeScript (#885) → Java (#891). This is the Java step for the new event-injection primitive.
Scope
FFI bindings (src/runtime/core/src/jobs_ffi.rs)
mesh_job_controller_recv_event(handle, types_json, timeout_secs, out_event_json) → i32 (0/-1/-2/-3)
mesh_job_proxy_send_event(handle, event_type, payload_json, out_receipt_json) → i32 (0/-1/-2/-3/-4) — distinct codes for JobNotFound vs JobTerminal
parse_ffi_timeout_secs helper: rejects NaN/±Inf, uses Duration::try_from_secs_f64 for overflow, negative-sentinel < 0 convention for "no timeout"
Java SDK (src/runtime/java/mcp-mesh-sdk/)
JobController.recvEvent(List<String> types, Duration timeout) returning Map<String, Object> (event) or null (timeout)
JobProxy.sendEvent(String eventType, Map<String, Object> payload) returning receipt Map
- New
MeshJobs.postEvent(jobId, eventType, payload) static helper — LRU-bounded JobProxy cache (default 256, env override MCP_MESH_JOBPROXY_CACHE_MAX) using LinkedHashMap(accessOrder=true) with explicit synchronized blocks
JobNotFoundException and JobTerminalException new typed exceptions extending the existing MeshException parent
Tests
- Rust FFI: +6 unit tests (jobs_ffi: 16 → 22)
- Java unit: +19 tests across
MeshJobsTest and JobEventApiTest (sdk: 42 → 61; full Java module: 124 tests pass)
- Integration suite
uc23_meshjob_java: 3 new test cases mirroring Python tc24/25/26 and TS tc24/25/26_ts:
tc24_event_injection_happy_path_java
tc25_event_type_filter_java
tc26_cancel_posts_synthetic_event_java
- Reuses existing
long-task-provider-java / long-task-consumer-java fixtures with 3 new tools each
- Baseline 23 + new 3 = 26/26 pass
Public API parity matrix (3 runtimes)
| API |
Java |
TypeScript |
Python |
| Producer wait for event |
job.recvEvent(types, duration) |
job.recvEvent(types, timeoutSecs) |
job.recv_event(types, timeout_secs) |
| Consumer post to specific proxy |
proxy.sendEvent(type, payload) |
proxy.sendEvent(type, payload) |
proxy.send_event(type, payload) |
| Convenience helper |
MeshJobs.postEvent(...) |
mesh.jobs.postEvent(...) |
mesh.jobs.post_event(...) |
| Typed errors |
JobNotFoundException / JobTerminalException |
JobNotFoundError / JobTerminalError |
JobNotFoundError / JobTerminalError |
| Proxy cache cap |
MCP_MESH_JOBPROXY_CACHE_MAX (256) |
same |
same |
| Cancel synthetic event grace |
Server-side (200ms, MCP_MESH_CANCEL_EVENT_GRACE_MS) — no client change needed |
|
|
Acceptance criteria
- Rust FFI tests: baseline + 6 new pass
- Java unit tests: baseline + 19 new pass
tsuite run --uc uc23_meshjob_java → 26/26 (23 baseline + 3 new)
- mcp-mesh-core JNR-FFI loads cleanly with the 2 new symbols
Related
Summary
Extend the Java SDK with MeshJob event-injection parity following the Python (#1041) and TypeScript (#1043) verticals already shipped for issue #1032.
Completes the original MeshJob cross-runtime shipping pattern: Python (#861/#878) → TypeScript (#885) → Java (#891). This is the Java step for the new event-injection primitive.
Scope
FFI bindings (
src/runtime/core/src/jobs_ffi.rs)mesh_job_controller_recv_event(handle, types_json, timeout_secs, out_event_json)→ i32 (0/-1/-2/-3)mesh_job_proxy_send_event(handle, event_type, payload_json, out_receipt_json)→ i32 (0/-1/-2/-3/-4) — distinct codes forJobNotFoundvsJobTerminalparse_ffi_timeout_secshelper: rejects NaN/±Inf, usesDuration::try_from_secs_f64for overflow, negative-sentinel< 0convention for "no timeout"Java SDK (
src/runtime/java/mcp-mesh-sdk/)JobController.recvEvent(List<String> types, Duration timeout)returningMap<String, Object>(event) ornull(timeout)JobProxy.sendEvent(String eventType, Map<String, Object> payload)returning receipt MapMeshJobs.postEvent(jobId, eventType, payload)static helper — LRU-boundedJobProxycache (default 256, env overrideMCP_MESH_JOBPROXY_CACHE_MAX) usingLinkedHashMap(accessOrder=true)with explicitsynchronizedblocksJobNotFoundExceptionandJobTerminalExceptionnew typed exceptions extending the existingMeshExceptionparentTests
MeshJobsTestandJobEventApiTest(sdk: 42 → 61; full Java module: 124 tests pass)uc23_meshjob_java: 3 new test cases mirroring Python tc24/25/26 and TS tc24/25/26_ts:tc24_event_injection_happy_path_javatc25_event_type_filter_javatc26_cancel_posts_synthetic_event_javalong-task-provider-java/long-task-consumer-javafixtures with 3 new tools eachPublic API parity matrix (3 runtimes)
job.recvEvent(types, duration)job.recvEvent(types, timeoutSecs)job.recv_event(types, timeout_secs)proxy.sendEvent(type, payload)proxy.sendEvent(type, payload)proxy.send_event(type, payload)MeshJobs.postEvent(...)mesh.jobs.postEvent(...)mesh.jobs.post_event(...)JobNotFoundException/JobTerminalExceptionJobNotFoundError/JobTerminalErrorJobNotFoundError/JobTerminalErrorMCP_MESH_JOBPROXY_CACHE_MAX(256)MCP_MESH_CANCEL_EVENT_GRACE_MS) — no client change neededAcceptance criteria
tsuite run --uc uc23_meshjob_java→ 26/26 (23 baseline + 3 new)Related