Package com.linkedin.databus.client

Examples of com.linkedin.databus.client.DatabusSourcesConnection$SourcesConnectionStatus


      // now create client:
      String srcSubscriptionString = TestUtil.join(srcNames[0], ",");
      String serverName = "localhost:" + chainedRelayPort;
      CountingConsumer countingConsumer = new CountingConsumer();
      DatabusSourcesConnection clientConn = RelayEventProducer
          .createDatabusSourcesConnection("testProducer", serverName,
              srcSubscriptionString, countingConsumer,
              1 * 1024 * 1024, largestEventSize, 30 * 1000, 100, 15 * 1000,
              1, true,largestEventSize/10);

View Full Code Here


      // start client in parallel
      String srcSubscriptionString = srcName;
      String serverName = "localhost:" + relayPort;
      ResetsCountingConsumer countingConsumer = new ResetsCountingConsumer();
      DatabusSourcesConnection clientConn = RelayEventProducer
      .createDatabusSourcesConnection("testProducer", serverName,
          srcSubscriptionString, countingConsumer,
          1 * 1024 * 1024, 50000, 30 * 1000, 100, 15 * 1000,
          1, true);

      cr = new ClientRunner(clientConn);
      cr.start();
      TestUtil.sleep(1000); // generate some events

      // pause event generator
      // and wait untill all the events are consumed
      // but since it is less then timeout the connection should NOT reset
      LOG.info("Sending pause to relay!");
      r1.pause();
      TestUtil.sleep(4000);

      LOG.info("no events, time less then threshold. Events=" + countingConsumer.getNumDataEvents() +
          "; resets = " + countingConsumer.getNumResets());
      Assert.assertEquals(countingConsumer.getNumResets(), 0);

      // generate more events, more time elapsed then the threshold, but since there are
      // events - NO reset
      r1.unpause();
      Thread.sleep(8000);
      LOG.info("some events, more time then timeout. Events=" + countingConsumer.getNumDataEvents() +
          "; resets = " + countingConsumer.getNumResets());
      Assert.assertEquals(countingConsumer.getNumResets(), 0);

      r1.pause(); // stop events
      //set threshold to 0 completely disabling the feature
      clientConn.getRelayPullThread().setNoEventsConnectionResetTimeSec(0);
      Thread.sleep(8000);
      LOG.info("no events, more time then timeout, but feature disabled. Events=" +
          countingConsumer.getNumDataEvents() + "; resets = " + countingConsumer.getNumResets());
      Assert.assertEquals(countingConsumer.getNumResets(), 0);


      // enable the feature, and sleep for timeout
      clientConn.getRelayPullThread().setNoEventsConnectionResetTimeSec(5);
      // now wait with no events
      LOG.info("pause the producer. sleep for 6 sec, should reset");
      TestUtil.sleep(6000);

      LOG.info("Client stats=" + countingConsumer);
View Full Code Here

    DatabusRelayConnectionFactory relayConnFactory = defaultConnFactory;
    DatabusBootstrapConnectionFactory bootstrapConnFactory = defaultConnFactory;
    ConnectionStateFactory connStateFactory = new ConnectionStateFactory(
        sourcesStrList);
    DatabusSourcesConnection conn = new DatabusSourcesConnection(
        connConfig,
        subsList,
        relayServices,
        bootstrapServices,
        relayConsumers,
View Full Code Here

    _log.info("Creating Sources Connection : Candidate Relays :"
                  + candidateRelays + ", CandidateBootstrapServers :"
              + candidateBootstrapServers + ", Subscriptions :" + subs);

    ConnectionStateFactory connStateFactory = new ConnectionStateFactory(DatabusSubscription.getStrList(subs));
    DatabusSourcesConnection sourcesConnection =
          new DatabusSourcesConnection(
              connConfig,
              subs,
              candidateRelays,
              candidateBootstrapServers,
              _streamConsumerRawRegistrations,
View Full Code Here

      String srcSubscriptionString = TestUtil.join(srcs, ",");
      String serverName = "localhost:" + relayPort;
      final EventsCountingConsumer countingConsumer = new EventsCountingConsumer();

      int id = (RngUtils.randomPositiveInt() % 10000) + 1;
      DatabusSourcesConnection clientConn = RelayEventProducer
      .createDatabusSourcesConnection("testProducer", id, serverName,
          srcSubscriptionString, countingConsumer,
          1 * 1024 * 1024, 50000, 30 * 1000, 100, 15 * 1000,
          1, true, DatabusClientNettyThreadPools.createNettyThreadPools(id),
          0, DbusEventFactory.DBUS_EVENT_V1,0);
View Full Code Here

      String srcSubscriptionString = TestUtil.join(srcs, ",");
      String serverName = "localhost:" + relayPort;
      final EventsCountingConsumer countingConsumer = new EventsCountingConsumer();

      int id = (RngUtils.randomPositiveInt() % 10000) + 1;
      DatabusSourcesConnection clientConn = RelayEventProducer
      .createDatabusSourcesConnection("testProducer", id, serverName,
          srcSubscriptionString, countingConsumer,
          1 * 1024 * 1024, 50000, 30 * 1000, 100, 15 * 1000,
          1, true, DatabusClientNettyThreadPools.createNettyThreadPools(id),
          0, DbusEventFactory.DBUS_EVENT_V1,0);

      cr = new ClientRunner(clientConn);

      log.info("starting client");
      cr.start();
      // wait till client gets the event
      TestUtil.assertWithBackoff(new ConditionCheck() {
        @Override
        public boolean check() {
          int events = countingConsumer.getNumDataEvents();
          LOG.info("client got " + events + " events");
          return events == 2;
        }
      },"Consumer didn't get 2 events ", 64 * 1024, LOG);

      // asserts
      Assert.assertEquals(countingConsumer.getNumDataEvents(), 2);
      Assert.assertEquals(countingConsumer.getNumWindows(), 2);
      Assert.assertEquals(countingConsumer.getNumDataEvents(DbusEventFactory.DBUS_EVENT_V1),2);
      log.info("shutdown first client");
      clientConn.stop();
      cr.shutdown();
      TestUtil.sleep(1000);
      cr = null;


View Full Code Here

                                                                                        // the
                                                                                        // callee
                                                                                        // throws
                                                                                        // an
                                                                                        // exception.
      DatabusSourcesConnection sourcesConn =
          _client.getDatabusSourcesConnection(reg.getRegistrationId().getId());
      regStatsInfo = new RegistrationStatsInfo(reg, sourcesConn);
      writeJsonObjectToResponse(regStatsInfo, request);
    }
  }
View Full Code Here

TOP

Related Classes of com.linkedin.databus.client.DatabusSourcesConnection$SourcesConnectionStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.