use of com.hazelcast.client.config.ClientReliableTopicConfig in project hazelcast by hazelcast.
the class ClientReliableTopicOverloadTest method setupCluster.
@Before
public void setupCluster() {
Config config = new Config();
config.addRingBufferConfig(new RingbufferConfig("when*").setCapacity(100).setTimeToLiveSeconds(Integer.MAX_VALUE));
hazelcastFactory.newHazelcastInstance(config);
ClientConfig clientConfig = new ClientConfig();
clientConfig.addReliableTopicConfig(new ClientReliableTopicConfig("whenError_*").setTopicOverloadPolicy(TopicOverloadPolicy.ERROR));
clientConfig.addReliableTopicConfig(new ClientReliableTopicConfig("whenDiscardOldest_*").setTopicOverloadPolicy(TopicOverloadPolicy.DISCARD_OLDEST));
clientConfig.addReliableTopicConfig(new ClientReliableTopicConfig("whenDiscardNewest_*").setTopicOverloadPolicy(TopicOverloadPolicy.DISCARD_NEWEST));
clientConfig.addReliableTopicConfig(new ClientReliableTopicConfig("whenBlock_*").setTopicOverloadPolicy(TopicOverloadPolicy.BLOCK));
HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig);
serializationService = ((HazelcastClientProxy) client).getSerializationService();
String topicName = getTestMethodName();
topic = client.<String>getReliableTopic(topicName);
ringbuffer = ((ClientReliableTopicProxy<String>) topic).getRingbuffer();
}
use of com.hazelcast.client.config.ClientReliableTopicConfig in project hazelcast by hazelcast.
the class ClientReliableTopicBlockTest method setup.
@Before
public void setup() {
Config config = smallInstanceConfig();
config.addRingBufferConfig(new RingbufferConfig("blockingReliableTopic*").setCapacity(10).setTimeToLiveSeconds(60));
hazelcastFactory.newHazelcastInstance(config);
ClientConfig clientConfig = new ClientConfig().addReliableTopicConfig(new ClientReliableTopicConfig("blockingReliableTopic*").setReadBatchSize(10).setTopicOverloadPolicy(TopicOverloadPolicy.BLOCK));
client = hazelcastFactory.newHazelcastClient(clientConfig);
}
use of com.hazelcast.client.config.ClientReliableTopicConfig in project hazelcast by hazelcast.
the class ClientDomConfigProcessor method handleReliableTopicNode.
protected void handleReliableTopicNode(Node node) {
String name = getName(node);
ClientReliableTopicConfig config = new ClientReliableTopicConfig(name);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if (matches("topic-overload-policy", nodeName)) {
config.setTopicOverloadPolicy(TopicOverloadPolicy.valueOf(getTextContent(child)));
} else if (matches("read-batch-size", lowerCaseInternal(nodeName))) {
config.setReadBatchSize(Integer.parseInt(getTextContent(child)));
}
}
clientConfig.addReliableTopicConfig(config);
}
use of com.hazelcast.client.config.ClientReliableTopicConfig in project hazelcast by hazelcast.
the class TestClientApplicationContext method testReliableTopicConfig.
@Test
public void testReliableTopicConfig() {
ClientConfig clientConfig = hazelcastReliableTopic.getClientConfig();
ClientReliableTopicConfig topicConfig = clientConfig.getReliableTopicConfig("rel-topic");
assertEquals(100, topicConfig.getReadBatchSize());
assertEquals(TopicOverloadPolicy.DISCARD_NEWEST, topicConfig.getTopicOverloadPolicy());
}
use of com.hazelcast.client.config.ClientReliableTopicConfig in project hazelcast by hazelcast.
the class ClientReliableTopicStressTest method setup.
@Before
public void setup() {
logger = Logger.getLogger(getClass());
Config config = new Config();
RingbufferConfig ringbufferConfig = new RingbufferConfig("foobar");
ringbufferConfig.setCapacity(10000000);
config.addRingBufferConfig(ringbufferConfig);
ClientConfig clientConfig = new ClientConfig();
ClientReliableTopicConfig topicConfig = new ClientReliableTopicConfig("foobar");
clientConfig.addReliableTopicConfig(topicConfig);
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
topic = client.getReliableTopic(topicConfig.getName());
}
Aggregations