Quarkus JSON-RPC
Expose your Java methods as JSON-RPC 2.0 endpoints — with a single annotation.
Quarkus JSON-RPC discovers classes annotated with @JsonRPCApi at build time and makes their public methods callable via the JSON-RPC 2.0 protocol. Choose your transport: WebSocket for browser and network clients, or JSONL over Unix domain sockets for local IPC. No manual routing, no protocol plumbing.
In a Glance
@JsonRPCApi
public class GreetingService {
public String hello(String name) {
return "Hello " + name;
}
}
Connect to ws://localhost:8080/json-rpc and send:
{
"jsonrpc": "2.0",
"id": 1,
"method": "GreetingService#hello",
"params": { "name": "World" }
}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "Hello World"
}
Installation
The extension is split into a transport-agnostic core and pluggable transport modules. Add the transport you need:
WebSocket transport
For browser clients, network clients, or any WebSocket-based integration:
<dependency>
<groupId>io.quarkiverse.json-rpc</groupId>
<artifactId>quarkus-json-rpc-websocket</artifactId>
<version>2.0.0</version>
</dependency>
Domain socket transport
For local IPC using JSONL (newline-delimited JSON) over Unix domain sockets:
<dependency>
<groupId>io.quarkiverse.json-rpc</groupId>
<artifactId>quarkus-json-rpc-domain-socket</artifactId>
<version>2.0.0</version>
</dependency>
Both transports can be used simultaneously in the same application. The @JsonRPCApi annotation and all core features work identically regardless of transport.
Key Features
- Pluggable transports
-
WebSocket for browser and network clients, or JSONL over Unix domain sockets for local IPC. Both transports share the same
@JsonRPCApiannotation and core engine - add a dependency and you’re done. - Build-time discovery
-
All
@JsonRPCApiclasses are found at build time via Jandex — no runtime classpath scanning, full ahead-of-time compilation and GraalVM native image support. - Reactive and blocking
-
Return plain types for blocking execution,
Uni<T>for async, orMulti<T>for streaming subscriptions. Fine-tune with@Blocking,@NonBlocking, or@RunOnVirtualThread. - Server push
-
Inject
JsonRPCBroadcasterto send notifications to all connected clients or target a specific session. - Flexible parameters
-
Call methods with named parameters (JSON object) or positional parameters (JSON array).
- POJO support
-
Complex types are serialized and deserialized automatically via Jackson, including nested objects, collections, and Java time types.
- Security
-
Secure your endpoints with standard Jakarta security annotations (
@RolesAllowed,@Authenticated, etc.) or Quarkus HTTP auth policies — opt-in, no changes needed for unsecured use cases. - Health check
-
When SmallRye Health is on the classpath, a readiness check is registered automatically — reporting endpoint status and active connection count.
- OpenRPC service discovery
-
An OpenRPC 1.3.2 document is generated at build time and served at
/json-rpc/openrpc.json, describing all methods, parameters, and return types with JSON Schema — enabling automatic client generation and documentation. - Timeouts
-
Protect against hanging methods with a global timeout or per-method
@Timeoutvia MicroProfile Fault Tolerance. - JavaScript client
-
Optionally generate a typed JavaScript proxy for all your endpoints, ready to import from Quarkus Web Bundler or any ES module environment.
- Dev UI
-
An interactive method browser and tester is available in the Quarkus Dev UI during development.
What’s Next?
| Page | Description |
|---|---|
Annotate your first class and understand method discovery rules. |
|
Blocking, non-blocking, |
|
Named vs. positional parameters and supported types. |
|
Subscribe to server-sent streams and manage subscriptions. |
|
Push notifications to clients from any CDI bean. |
|
Secure endpoints with annotations or HTTP auth policies. |
|
Connection isolation, shared bean instances, threading model, and tuning for production. |
|
React to client connect and disconnect via CDI events. |
|
Protect against hanging methods with global or per-method timeouts. |
|
Automatic request timing and connection tracking with Micrometer. |
|
Automatic readiness health check with active connection count. |
|
Machine-readable API description with JSON Schema for all methods. |
|
Generate a typed JavaScript proxy for calling your endpoints from the browser. |
|
Serve JSON-RPC over Unix domain sockets using JSONL framing for local IPC. |
|
All available configuration properties. |