本文整理汇总了Java中com.hazelcast.config.TopicConfig类的典型用法代码示例。如果您正苦于以下问题:Java TopicConfig类的具体用法?Java TopicConfig怎么用?Java TopicConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TopicConfig类属于com.hazelcast.config包,在下文中一共展示了TopicConfig类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activate
import com.hazelcast.config.TopicConfig; //导入依赖的package包/类
@Activate
protected void activate() {
localNodeId = clusterService.getLocalNode().id();
listenerRegistry = new AbstractListenerRegistry<>();
eventDispatcher.addSink(LeadershipEvent.class, listenerRegistry);
TopicConfig topicConfig = new TopicConfig();
topicConfig.setGlobalOrderingEnabled(true);
topicConfig.setName(TOPIC_HZ_ID);
storeService.getHazelcastInstance().getConfig().addTopicConfig(topicConfig);
messageHandlingExecutor = Executors.newSingleThreadExecutor(
groupedThreads("onos/store/leadership", "message-handler"));
clusterCommunicator.addSubscriber(
LEADERSHIP_EVENT_MESSAGE_SUBJECT,
new InternalLeadershipEventListener(),
messageHandlingExecutor);
log.info("Hazelcast Leadership Service started");
}
示例2: setTopicConfig
import com.hazelcast.config.TopicConfig; //导入依赖的package包/类
private void setTopicConfig(Config config) {
TopicConfig topicConfig = config.getTopicConfig("yourTopicName");
topicConfig.setGlobalOrderingEnabled(true);
topicConfig.setStatisticsEnabled(true);
MessageListener<String> implementation = new MessageListener<String>() {
@Override
public void onMessage(Message<String> message) {
// process the message
}
};
topicConfig.addMessageListenerConfig(new ListenerConfig(implementation));
}
示例3: initializeListeners
import com.hazelcast.config.TopicConfig; //导入依赖的package包/类
private void initializeListeners() {
final TopicConfig topicConfig = node.config.findMatchingTopicConfig(name);
for (ListenerConfig lc : topicConfig.getMessageListenerConfigs()) {
try {
node.listenerManager.createAndAddListenerItem(name, lc, InstanceType.TOPIC);
for (MemberImpl member : node.clusterManager.getMembers()) {
addListener(member.getAddress(), true);
}
} catch (Exception e) {
logger.log(Level.SEVERE, e.getMessage(), e);
}
}
}
示例4: getConfig
import com.hazelcast.config.TopicConfig; //导入依赖的package包/类
@JMXAttribute("Config")
@JMXDescription("Topic configuration")
public String getConfig() {
final TopicConfig config = managementService.getInstance().getConfig().getTopicConfig(getName());
return config.toString();
}