Quarkus JSON-RPC

Expose your Java methods as JSON-RPC 2.0 endpoints over WebSocket — 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 over a WebSocket connection. 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/quarkus/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

Add the extension to your project:

<dependency>
    <groupId>io.quarkiverse.json-rpc</groupId>
    <artifactId>quarkus-json-rpc</artifactId>
    <version>0.0.5</version>
</dependency>

Key Features

Build-time discovery

All @JsonRPCApi classes 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, or Multi<T> for streaming subscriptions. Fine-tune with @Blocking and @NonBlocking.

Server push

Inject JsonRPCBroadcaster to 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.

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

Creating an API

Annotate your first class and understand method discovery rules.

Execution Modes & Return Types

Blocking, non-blocking, Uni, Multi, CompletionStage — how the extension dispatches your methods.

Parameters

Named vs. positional parameters and supported types.

Streaming with Multi

Subscribe to server-sent streams and manage subscriptions.

Broadcasting

Push notifications to clients from any CDI bean.

Security

Secure endpoints with annotations or HTTP auth policies.

Concurrency & Session Isolation

Connection isolation, shared bean instances, threading model, and tuning for production.

JavaScript Client

Generate a typed JavaScript proxy for calling your endpoints from the browser.

Configuration Reference

All available configuration properties.