当前位置: 首页>>代码示例>>Java>>正文


Java FetchedDataChunk类代码示例

本文整理汇总了Java中kafka.consumer.FetchedDataChunk的典型用法代码示例。如果您正苦于以下问题:Java FetchedDataChunk类的具体用法?Java FetchedDataChunk怎么用?Java FetchedDataChunk使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FetchedDataChunk类属于kafka.consumer包,在下文中一共展示了FetchedDataChunk类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MockKafkaStream

import kafka.consumer.FetchedDataChunk; //导入依赖的package包/类
public MockKafkaStream(int numStreams) {

    this.queues = Lists.newArrayList();
    this.mockStreams = Lists.newArrayList();
    this.offsets = Lists.newArrayList();

    for (int i = 0; i < numStreams; i++) {
      BlockingQueue<FetchedDataChunk> queue = Queues.newLinkedBlockingQueue();
      this.queues.add(queue);
      this.mockStreams.add(createMockStream(queue));
      this.offsets.add(new AtomicLong(0));
    }

    this.nextStream = new AtomicLong(-1);
  }
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:16,代码来源:MockKafkaStream.java

示例2: createMockStream

import kafka.consumer.FetchedDataChunk; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static KafkaStream<byte[], byte[]> createMockStream(BlockingQueue<FetchedDataChunk> queue) {

  KafkaStream<byte[], byte[]> stream = (KafkaStream<byte[], byte[]>) Mockito.mock(KafkaStream.class);
  ConsumerIterator<byte[], byte[]> it =
      new ConsumerIterator<>(queue, -1, new DefaultDecoder(new VerifiableProperties()), new DefaultDecoder(new VerifiableProperties()), "clientId");
  Mockito.when(stream.iterator()).thenReturn(it);

  return stream;
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:11,代码来源:MockKafkaStream.java

示例3: pushToStream

import kafka.consumer.FetchedDataChunk; //导入依赖的package包/类
public void pushToStream(String message) {

    int streamNo = (int) this.nextStream.incrementAndGet() % this.queues.size();

    AtomicLong offset = this.offsets.get(streamNo);
    BlockingQueue<FetchedDataChunk> queue = this.queues.get(streamNo);

    AtomicLong thisOffset = new AtomicLong(offset.incrementAndGet());

    List<Message> seq = Lists.newArrayList();
    seq.add(new Message(message.getBytes(Charsets.UTF_8)));
    ByteBufferMessageSet messageSet = new ByteBufferMessageSet(NoCompressionCodec$.MODULE$, offset, JavaConversions.asScalaBuffer(seq));

    FetchedDataChunk chunk = new FetchedDataChunk(messageSet,
        new PartitionTopicInfo("topic", streamNo, queue, thisOffset, thisOffset, new AtomicInteger(1), "clientId"),
        thisOffset.get());

    queue.add(chunk);
  }
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:20,代码来源:MockKafkaStream.java

示例4: shutdown

import kafka.consumer.FetchedDataChunk; //导入依赖的package包/类
public void shutdown() {
  for (BlockingQueue<FetchedDataChunk> queue : this.queues) {
    queue.add(ZookeeperConsumerConnector.shutdownCommand());
  }
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:6,代码来源:MockKafkaStream.java


注:本文中的kafka.consumer.FetchedDataChunk类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。