Client SDKsJavaReference
Client
Client classes, builders, and lifecycle — KubeMQ Java SDK reference.
The Java SDK splits messaging APIs across focused clients: pub/sub (PubSubClient), queues (QueuesClient), and commands/queries (CQClient). All extend shared connection management and implement AutoCloseable.
Package
<dependency>
<groupId>io.kubemq.sdk</groupId>
<artifactId>kubemq-sdk-Java</artifactId>
<version>3.1.1</version>
</dependency>Requires Java 11+.
Client classes
| Class | Package | Patterns |
|---|---|---|
PubSubClient | io.kubemq.sdk.pubsub | Events, Events Store |
QueuesClient | io.kubemq.sdk.queues | Queues |
CQClient | io.kubemq.sdk.cq | Commands, Queries |
Builder construction
PubSubClient pub = PubSubClient.builder()
.address("localhost:50000")
.clientId("java-pub")
.build();
QueuesClient queues = QueuesClient.builder()
.address("localhost:50000")
.clientId("java-q")
.build();
CQClient cq = CQClient.builder()
.address("localhost:50000")
.clientId("java-cq")
.build();Parameters (typical builder fields):
| Name | Type | Required | Description |
|---|---|---|---|
address | String | Yes | host:port for the broker |
clientId | String | Yes | Stable ID for this process |
authToken | String | No | Bearer token |
| TLS / cert fields | various | No | Mutual TLS and trust material |
reconnectionConfig | ReconnectionConfig | No | Backoff and retry tuning |
Returns: Concrete client instance ready for RPCs.
Throws: KubeMQException — validation or connection failures during build().
Lifecycle
Prefer try-with-resources because each client implements AutoCloseable:
try (PubSubClient client = PubSubClient.builder().address("localhost:50000").clientId("demo").build()) {
// use client
}Quick Usage
try (PubSubClient pub = PubSubClient.builder()
.address("localhost:50000")
.clientId("reference-demo")
.build()) {
// Events APIs live on PubSubClient — see Events reference page
}See Also
Was this page helpful?