Package com.linkedin.databus.client

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


      // 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

            clientPrincipal = (name.getKrb5PrincipalName()).getName();
            realm = (name.getKrb5PrincipalName()).getRealmAsString();
        } else {
            clientPrincipal = null;
            try {
                Config config = Config.getInstance();
                realm = config.getDefaultRealm();
            } catch (KrbException e) {
                GSSException ge =
                        new GSSException(GSSException.NO_CRED, -1,
                            "Attempt to obtain INITIATE credentials failed!" +
                            " (" + e.getMessage() + ")");
View Full Code Here

     */
    public static CksumType getInstance() throws KdcErrException {
        // this method provided for Kerberos applications.
        int cksumType = Checksum.CKSUMTYPE_RSA_MD5; // default
        try {
            Config c = Config.getInstance();
            if ((cksumType = (c.getType(c.getDefault("ap_req_checksum_type",
                                "libdefaults")))) == - 1) {
                if ((cksumType = c.getType(c.getDefault("checksum_type",
                                "libdefaults"))) == -1) {
                    cksumType = Checksum.CKSUMTYPE_RSA_MD5; // default
                }
            }
        } catch (KrbException e) {
View Full Code Here

     */

    private static String[] parseCapaths(String cRealm, String sRealm) throws KrbException {
        String[] retList = null;

        Config cfg = null;
        try {
            cfg = Config.getInstance();
        } catch (Exception exc) {
            if (DEBUG) {
                System.out.println ("Configuration information can not be " +
                                    "obtained " + exc.getMessage());
            }
            return null;
        }

        String intermediaries = cfg.getDefault(sRealm, cRealm);

        if (intermediaries == null) {
            if (DEBUG) {
                System.out.println(">>> Realm parseCapaths: no cfg entry");
            }
            return null;
        }

        String tempTarget = null, tempRealm = null;
        StringTokenizer strTok = null;
        Stack<String> iStack = new Stack<String> ();

        /*
         * I don't expect any more than a handful of intermediaries.
         */
        Vector<String> tempList = new Vector<String> (8, 8);

        /*
         * The initiator at first location.
         */
        tempList.add(cRealm);

        int count = 0; // For debug only
        if (DEBUG) {
            tempTarget = sRealm;
        }

        do {
            if (DEBUG) {
                count++;
                System.out.println(">>> Realm parseCapaths: loop " +
                                   count + ": target=" + tempTarget);
            }

            if (intermediaries != null &&
                !intermediaries.equals(PrincipalName.REALM_COMPONENT_SEPARATOR_STR))
            {
                if (DEBUG) {
                    System.out.println(">>> Realm parseCapaths: loop " +
                                       count + ": intermediaries=[" +
                                       intermediaries + "]");
                }

                /*
                 * We have one or more space-separated intermediary realms.
                 * Stack them.
                 */
                strTok = new StringTokenizer(intermediaries, " ");
                while (strTok.hasMoreTokens())
                {
                    tempRealm = strTok.nextToken();
                    if (!tempRealm.equals(PrincipalName.
                                          REALM_COMPONENT_SEPARATOR_STR) &&
                        !iStack.contains(tempRealm)) {
                        iStack.push(tempRealm);
                        if (DEBUG) {
                            System.out.println(">>> Realm parseCapaths: loop " +
                                               count +
                                               ": pushed realm on to stack: " +
                                               tempRealm);
                        }
                    } else if (DEBUG) {
                        System.out.println(">>> Realm parseCapaths: loop " +

                                           count +
                                           ": ignoring realm: [" +
                                           tempRealm + "]");
                    }
                }
            } else if (DEBUG) {
                System.out.println(">>> Realm parseCapaths: loop " +
                                   count +
                                   ": no intermediaries");
            }

            /*
             * Get next intermediary realm from the stack
             */

            try {
                tempTarget = iStack.pop();
            } catch (EmptyStackException exc) {
                tempTarget = null;
            }

            if (tempTarget == null) {
                /*
                 * No more intermediaries. We're done.
                 */
                break;
            }

            tempList.add(tempTarget);

            if (DEBUG) {
                System.out.println(">>> Realm parseCapaths: loop " + count +
                                   ": added intermediary to list: " +
                                   tempTarget);
            }

            intermediaries = cfg.getDefault(tempTarget, cRealm);

        } while (true);

        retList = new String[tempList.size()];
        try {
View Full Code Here

TOP

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

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.