Package kafka.serializer

Examples of kafka.serializer.StringDecoder


    consumerProps.setProperty("zookeeper.connect", updateQueueLockMaster);
    ConsumerConfig consumerConfig = new ConsumerConfig(consumerProps);
    consumer = Consumer$.MODULE$.createJavaConsumerConnector(consumerConfig);
    KafkaStream<String,U> stream =
        consumer.createMessageStreams(Collections.singletonMap(updateTopic, 1),
                                      new StringDecoder(null),
                                      loadDecoderInstance())
            .get(updateTopic).get(0);
    final Iterator<KeyMessage<String,U>> transformed = Iterators.transform(stream.iterator(),
        new Function<MessageAndMetadata<String,U>, KeyMessage<String,U>>() {
          @Override
View Full Code Here


  ConsumeDataIterator(String topic, ConsumerConnector consumer) {
    this.consumer = consumer;
    this.iterator =
        consumer.createMessageStreams(Collections.singletonMap(topic, 1),
                                      new StringDecoder(null),
                                      new StringDecoder(null)).get(topic).get(0).iterator();
  }
View Full Code Here

    consumerProps.setProperty("zookeeper.connect", updateQueueLockMaster);
    ConsumerConfig consumerConfig = new ConsumerConfig(consumerProps);
    consumer = Consumer$.MODULE$.createJavaConsumerConnector(consumerConfig);
    KafkaStream<String,U> stream =
        consumer.createMessageStreams(Collections.singletonMap(updateTopic, 1),
                                      new StringDecoder(null),
                                      loadDecoderInstance())
            .get(updateTopic).get(0);
    final Iterator<KeyMessage<String,U>> transformed = Iterators.transform(stream.iterator(),
        new Function<MessageAndMetadata<String,U>, KeyMessage<String,U>>() {
          @Override
View Full Code Here

    private void consumeMessages() {
        final ConsumerConnector   consumer =
                kafka.consumer.Consumer.createJavaConsumerConnector(createConsumerConfig());
        final Map<String, Integer> topicCountMap = ImmutableMap.of(topic, 1);
        final Map<String, List<KafkaStream<String>>> consumerMap;
        consumerMap = consumer.createMessageStreams(topicCountMap, new StringDecoder());

        final KafkaStream<String> stream = consumerMap.get(topic).get(0);
        final ConsumerIterator<String> iterator = stream.iterator();

        kafkaMessageReceiverThread = new Thread(
View Full Code Here

            final ConsumerConnector consumer =
                    kafka.consumer.Consumer.createJavaConsumerConnector(createConsumerConfig());
            final Map<String, Integer> topicCountMap = ImmutableMap.of(topic, 1);
            final Map<String, List<KafkaStream<String,String>>> consumerMap;

            StringDecoder decoder = new StringDecoder(new VerifiableProperties());
            consumerMap = consumer.createMessageStreams(topicCountMap, decoder,  decoder);

            final KafkaStream<String,String> stream = consumerMap.get(topic).get(0);
            final ConsumerIterator<String,String> iterator = stream.iterator();
            while (iterator.hasNext()) {
View Full Code Here

    private void consumeMessages() {
        final ConsumerConnector   consumer =
                kafka.consumer.Consumer.createJavaConsumerConnector(createConsumerConfig());
        final Map<String, Integer> topicCountMap =
                ImmutableMap.of(topic, 1);
        final StringDecoder decoder =
                new StringDecoder(new VerifiableProperties());
        final Map<String, List<KafkaStream<String,String>>>  consumerMap =
                consumer.createMessageStreams(topicCountMap, decoder,  decoder);
        final KafkaStream<String,String> stream =
                consumerMap.get(topic).get(0);
        final ConsumerIterator<String,String> iterator = stream.iterator();
View Full Code Here

    public String readMessage(ConsumerConnector consumer) {
        Map<String, Integer> topicCountMap = new HashMap<String, Integer>();
        topicCountMap.put(topic, new Integer(1));
        KafkaStream<String, String> messageStream = consumer.createMessageStreamsByFilter(new Whitelist(topic),
                                                                                          1,
                                                                                          new StringDecoder(null),
                                                                                          new StringDecoder(null)).get(0);

        return messageStream.iterator().next().message();
    }
View Full Code Here

        TopicFilter filterSpec = new Whitelist(topic);

        log.info("Trying to start consumer: topic=%s for zk=%s and groupId=%s".format(topic, zkConnect, groupId));
        messageStream = consumerConnector.createMessageStreamsByFilter(filterSpec,
                1,
                new StringDecoder(null),
                new StringDecoder(null)).head();
        log.info("Started consumer: topic=%s for zk=%s and groupId=%s".format(topic, zkConnect, groupId));
        graphiteClient = new GraphiteClient(graphiteHost, graphitePort);
    }
View Full Code Here

TOP

Related Classes of kafka.serializer.StringDecoder

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.