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


Java ChannelProcessor类代码示例

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


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

示例1: start

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
@Override
public void start() {
  PollableSource source = (PollableSource) getSource();
  ChannelProcessor cp = source.getChannelProcessor();
  cp.initialize();
  source.start();

  runner = new PollingRunner();

  runner.source = source;
  runner.counterGroup = counterGroup;
  runner.shouldStop = shouldStop;

  runnerThread = new Thread(runner);
  runnerThread.setName(getClass().getSimpleName() + "-" + 
      source.getClass().getSimpleName() + "-" + source.getName());
  runnerThread.start();

  lifecycleState = LifecycleState.START;
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:21,代码来源:PollableSourceRunner.java

示例2: stop

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
@Override
public void stop() {

  runner.shouldStop.set(true);

  try {
    runnerThread.interrupt();
    runnerThread.join();
  } catch (InterruptedException e) {
    logger.warn("Interrupted while waiting for polling runner to stop. Please report this.", e);
    Thread.currentThread().interrupt();
  }

  Source source = getSource();
  source.stop();
  ChannelProcessor cp = source.getChannelProcessor();
  cp.close();

  lifecycleState = LifecycleState.STOP;
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:21,代码来源:PollableSourceRunner.java

示例3: MultiportSyslogHandler

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
public MultiportSyslogHandler(int maxEventSize, int batchSize,
    ChannelProcessor cp, SourceCounter ctr, String portHeader,
    ThreadSafeDecoder defaultDecoder,
    ConcurrentMap<Integer, ThreadSafeDecoder> portCharsets,
    Set<String> keepFields) {
  channelProcessor = cp;
  sourceCounter = ctr;
  this.maxEventSize = maxEventSize;
  this.batchSize = batchSize;
  this.portHeader = portHeader;
  this.defaultDecoder = defaultDecoder;
  this.portCharsets = portCharsets;
  this.keepFields = keepFields;
  syslogParser = new SyslogParser();
  lineSplitter = new LineSplitter(maxEventSize);
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:17,代码来源:MultiportSyslogTCPSource.java

示例4: setUp

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
@Before
public void setUp() throws UnknownHostException {
  localhost = InetAddress.getByName("127.0.0.1");
  source = new AvroSource();
  channel = new MemoryChannel();

  Configurables.configure(channel, new Context());

  List<Channel> channels = new ArrayList<Channel>();
  channels.add(channel);

  ChannelSelector rcs = new ReplicatingChannelSelector();
  rcs.setChannels(channels);

  source.setChannelProcessor(new ChannelProcessor(rcs));
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:17,代码来源:TestAvroSource.java

示例5: init

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
private void init(String keepFields) {
  source = new SyslogUDPSource();
  channel = new MemoryChannel();

  Configurables.configure(channel, new Context());

  List<Channel> channels = new ArrayList<Channel>();
  channels.add(channel);

  ChannelSelector rcs = new ReplicatingChannelSelector();
  rcs.setChannels(channels);

  source.setChannelProcessor(new ChannelProcessor(rcs));
  Context context = new Context();
  context.put("host", InetAddress.getLoopbackAddress().getHostAddress());
  context.put("port", String.valueOf(TEST_SYSLOG_PORT));
  context.put("keepFields", keepFields);

  source.configure(context);

}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:22,代码来源:TestSyslogUdpSource.java

示例6: init

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
private void init(String keepFields) {
  source = new SyslogTcpSource();
  channel = new MemoryChannel();

  Configurables.configure(channel, new Context());

  List<Channel> channels = new ArrayList<>();
  channels.add(channel);

  ChannelSelector rcs = new ReplicatingChannelSelector();
  rcs.setChannels(channels);

  source.setChannelProcessor(new ChannelProcessor(rcs));
  Context context = new Context();
  context.put("port", String.valueOf(TEST_SYSLOG_PORT));
  context.put("keepFields", keepFields);

  source.configure(context);

}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:21,代码来源:TestSyslogTcpSource.java

示例7: setUp

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
@Before
public void setUp() {
  source = new SpoolDirectorySource();
  channel = new MemoryChannel();

  Configurables.configure(channel, new Context());

  List<Channel> channels = new ArrayList<Channel>();
  channels.add(channel);

  ChannelSelector rcs = new ReplicatingChannelSelector();
  rcs.setChannels(channels);

  source.setChannelProcessor(new ChannelProcessor(rcs));
  tmpDir = Files.createTempDir();
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:17,代码来源:TestSpoolDirectorySource.java

示例8: setUp

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
/**
 * We set up the the Netcat source and Flume Memory Channel on localhost
 *
 * @throws UnknownHostException
 */
@Before
public void setUp() throws UnknownHostException {
  localhost = InetAddress.getByName("127.0.0.1");
  source = new NetcatSource();
  channel = new MemoryChannel();

  Configurables.configure(channel, new Context());

  List<Channel> channels = new ArrayList<Channel>();
  channels.add(channel);

  ChannelSelector rcs = new ReplicatingChannelSelector();
  rcs.setChannels(channels);

  source.setChannelProcessor(new ChannelProcessor(rcs));
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:22,代码来源:TestNetcatSource.java

示例9: setUp

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
@Before
public void setUp() {
  source = new TaildirSource();
  channel = new MemoryChannel();

  Configurables.configure(channel, new Context());

  List<Channel> channels = new ArrayList<Channel>();
  channels.add(channel);

  ChannelSelector rcs = new ReplicatingChannelSelector();
  rcs.setChannels(channels);

  source.setChannelProcessor(new ChannelProcessor(rcs));
  tmpDir = Files.createTempDir();
  posFilePath = tmpDir.getAbsolutePath() + "/taildir_position_test.json";
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:18,代码来源:TestTaildirSource.java

示例10: createGoodChannel

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
ChannelProcessor createGoodChannel() {

    ChannelProcessor channelProcessor = mock(ChannelProcessor.class);

    events = Lists.newArrayList();

    doAnswer(new Answer<Void>() {
      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        events.addAll((List<Event>)invocation.getArguments()[0]);
        return null;
      }
    }).when(channelProcessor).processEventBatch(any(List.class));

    return channelProcessor;
  }
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:17,代码来源:TestKafkaSource.java

示例11: setUpClass

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
@BeforeClass
public static void setUpClass() throws Exception {
  port = findFreePort();
  Context context = new Context();
  context.put("port", String.valueOf(port));

  scribeSource = new ScribeSource();
  scribeSource.setName("Scribe Source");

  Configurables.configure(scribeSource, context);

  memoryChannel = new MemoryChannel();
  Configurables.configure(memoryChannel, context);

  List<Channel> channels = new ArrayList<Channel>(1);
  channels.add(memoryChannel);

  ChannelSelector rcs = new ReplicatingChannelSelector();
  rcs.setChannels(channels);

  memoryChannel.start();

  scribeSource.setChannelProcessor(new ChannelProcessor(rcs));
  scribeSource.start();
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:26,代码来源:TestScribeSource.java

示例12: setUp

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
@Before
public void setUp() {
  logger.info("Running setup");

  channel = new MemoryChannel();
  source = new NetcatSource();

  Context context = new Context();

  Configurables.configure(channel, context);
  List<Channel> channels = Lists.newArrayList(channel);
  ChannelSelector rcs = new ReplicatingChannelSelector();
  rcs.setChannels(channels);

  source.setChannelProcessor(new ChannelProcessor(rcs));
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:17,代码来源:TestNetcatSource.java

示例13: before

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
protected final void before() throws Throwable {
  super.before();
  source = new LegacyHttpSource();
  channel = new MemoryChannel();
  context = new Context();

  context.put("port", Integer.toString(port));
  context.put("tsdb.url", "http://" + tsdbHostPort);
  context.put("keep-alive", "1");
  context.put("capacity", "1000");
  context.put("transactionCapacity", "1000");
  Configurables.configure(source, context);
  Configurables.configure(channel, context);


  rcs = new ReplicatingChannelSelector();
  rcs.setChannels(Lists.newArrayList(channel));

  source.setChannelProcessor(new ChannelProcessor(rcs));

  source.start();
}
 
开发者ID:yandex,项目名称:opentsdb-flume,代码行数:23,代码来源:LegacyHttpSourceTest.java

示例14: before

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
protected final void before() throws Throwable {
  super.before();
  source = new OpenTSDBSource();
  channel = new MemoryChannel();
  context = new Context();

  context.put("port", Integer.toString(port));
  context.put("capacity", Integer.toString(CHANNEL_SIZE));
  context.put("transactionCapacity", Integer.toString(CHANNEL_SIZE));
  context.put("keep-alive", "0");
  context.put("batchSize", Integer.toString(CHANNEL_SIZE));
  Configurables.configure(source, context);
  Configurables.configure(channel, context);

  rcs = new ReplicatingChannelSelector();
  rcs.setChannels(Lists.newArrayList(channel));

  source.setChannelProcessor(new ChannelProcessor(rcs));

  source.start();
}
 
开发者ID:yandex,项目名称:opentsdb-flume,代码行数:22,代码来源:OpenTSDBSourceTest.java

示例15: setUp

import org.apache.flume.channel.ChannelProcessor; //导入依赖的package包/类
@Before
@Override
public void setUp() throws Exception {
  super.setUp();
  //setup flume to write to
  source = new AvroSource();
  ch = new MemoryChannel();
  Configurables.configure(ch, new Context());

  Context context = new Context();
  //This should match whats present in the pipeline.json file
  context.put("port", String.valueOf(9050));
  context.put("bind", "localhost");
  Configurables.configure(source, context);

  List<Channel> channels = new ArrayList<>();
  channels.add(ch);
  ChannelSelector rcs = new ReplicatingChannelSelector();
  rcs.setChannels(channels);
  source.setChannelProcessor(new ChannelProcessor(rcs));
  source.start();
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:23,代码来源:FlumeDestinationPipelineRunIT.java


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