SDK
SDK Java v3.x
2

This SDK is deprecated. We recommend to use the Kuzzle SDK-JVM.
A migration guide is available here

publish #

Sends a real-time message to Kuzzle. The message will be broadcasted to all clients with subscriptions matching the index, the collection and the message content.

The index and collection are indicative and serve only to distinguish the rooms. They are not required to exist in the database.

Note: real-time messages are not persisted in the database.

Arguments #

public CompletableFuture<Integer> publish(
  final String index, 
  final String collection, 
  final ConcurrentHashMap<String, Object> message) 
    throws NotConnectedException, InternalException
ArgumentTypeDescription
index
String
Index name
collection
String
Collection name
message
ConcurrentHashMap<String, Object>
ConcurrentHashMap representing a JSON payload

Usage #

ConcurrentHashMap<String, Object> document = new ConcurrentHashMap<>();
document.put("name", "nina-vkote");
kuzzle.getRealtimeController().publish("my-index", "my-collection", document);