Topic Sets
info
This API is currently in beta and available via KeySessionExperimental.
A Topic Set is a collection of topics. When subscribing to a Topic Set, you will be automatically subscribed and receive updates to all the topics that belong to the set.
Creating a Topic Set
TopicSet set = session.createTopicSet(Topics.create("Price", "UST", "OTR"));
set.add("Price", "UST", "2Y");
set.add("Price", "UST", "5Y");
set.applyChanges();
Note that set.applyChanges() atomically adds all the topics into the set and publishes this onto the platform.
Subscribing to a Topic Set
// subscribe to data within the set
session.subscribeTopicSet("Price", "UST", "OTR", new TopicSetSubscriptionListener() {
@Override
public void complete(long count) {
log.info("TopicSet subscription complete, got {} items", count);
}
});