Package com.pinterest.secor.consumer

Examples of com.pinterest.secor.consumer.Consumer


                + " consumer threads");
        System.out.println("Rate limit:" + config.getMessagesPerSecond());
        LinkedList<Consumer> consumers = new LinkedList<Consumer>();
        long startMillis = System.currentTimeMillis();
        for (int i = 0; i < config.getConsumerThreads(); ++i) {
            Consumer consumer = new Consumer(config);
            consumer.setUncaughtExceptionHandler(handler);
            consumers.add(consumer);
            consumer.start();
        }

        while (true) {
            for (Consumer consumer : consumers) {
                for (String topic : topics) {
                    for (int i = 0; i < num_partitions; i++) {
                        OffsetTracker offsetTracker = consumer
                                .getOffsetTracker();
                        long val = (offsetTracker == null) ? -1
                                : offsetTracker
                                        .getLastSeenOffset(new TopicPartition(
                                                topic, i)) + 1;
View Full Code Here


                }
            };
            LOG.info("starting " + config.getConsumerThreads() + " consumer threads");
            LinkedList<Consumer> consumers = new LinkedList<Consumer>();
            for (int i = 0; i < config.getConsumerThreads(); ++i) {
                Consumer consumer = new Consumer(config);
                consumer.setUncaughtExceptionHandler(handler);
                consumers.add(consumer);
                consumer.start();
            }
            for (Consumer consumer : consumers) {
                consumer.join();
            }
        } catch (Throwable t) {
            LOG.error("Consumer failed", t);
            System.exit(1);
        }
View Full Code Here

TOP

Related Classes of com.pinterest.secor.consumer.Consumer

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.