Ejemplo n.º 1
0
 public ReliableTopicConfig findReliableTopicConfig(String name) {
   String baseName = getBaseName(name);
   ReliableTopicConfig config = lookupByPattern(reliableTopicConfigs, baseName);
   if (config != null) {
     return config.getAsReadOnly();
   }
   return getReliableTopicConfig("default").getAsReadOnly();
 }
Ejemplo n.º 2
0
  @Test
  public void readReliableTopic() {
    String xml =
        "<hazelcast xmlns=\"http://www.hazelcast.com/schema/config\">\n"
            + "    <reliable-topic name=\"custom\">\n"
            + "           <read-batch-size>35</read-batch-size>\n"
            + "           <statistics-enabled>false</statistics-enabled>\n"
            + "           <topic-overload-policy>DISCARD_OLDEST</topic-overload-policy>\n"
            + "           <message-listeners>"
            + "               <message-listener>MessageListenerImpl</message-listener>"
            + "           </message-listeners>"
            + "    </reliable-topic>\n"
            + "</hazelcast>";

    Config config = buildConfig(xml);

    ReliableTopicConfig topicConfig = config.getReliableTopicConfig("custom");

    assertEquals(35, topicConfig.getReadBatchSize());
    assertFalse(topicConfig.isStatisticsEnabled());
    assertEquals(TopicOverloadPolicy.DISCARD_OLDEST, topicConfig.getTopicOverloadPolicy());

    // checking listener configuration
    assertEquals(1, topicConfig.getMessageListenerConfigs().size());
    ListenerConfig listenerConfig = topicConfig.getMessageListenerConfigs().get(0);
    assertEquals("MessageListenerImpl", listenerConfig.getClassName());
    assertNull(listenerConfig.getImplementation());
  }
Ejemplo n.º 3
0
 public Config addReliableTopicConfig(ReliableTopicConfig topicConfig) {
   reliableTopicConfigs.put(topicConfig.getName(), topicConfig);
   return this;
 }