Skip to main content

Publication

A number of publish methods exist on KeySession which can be used to publish data onto the platform.

The general form of the publication methods is as follows:

Publish a Java Map, Java POJO or DTO
session.publish(<data>, <topic source>, <topic group>, <topic id>);
Publish a DTO or SBE with the topic defined in the header
session.publish(<data>);

Key Header Fields

There are a number of header fields that should be populated on data being published. See KeyHeader for more details.

Depending on the serialization type, some of these fields can be auto-populated by the API. Note that SBE is never auto-populated to allow for the maximum level of control and performance.

KeyHeader FieldSBEDTOPOJOComment
applicationId✔️✔️This can be obtained from KeySession.getApplicationId()
topicSource✔️✔️Default value is the application name
topicGroup✔️✔️Default value is "NONE" (available as a constant in Topic.DEFAULT_GROUP)
topicIdThe topicId must always be specified
inceptionNanoTime✔️✔️This can be obtained using the NanoClock

POJO and Map Serialization

Java POJOs and Maps etc. are automatically serialized into JSON format and published using the Flexible type which acts as an envelope. The Flexible type provides the necessary KeyHeader fields needed to publish data onto the platform.