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


Java ChannelProcessor.initialize方法代码示例

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


在下文中一共展示了ChannelProcessor.initialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: start

import org.apache.flume.channel.ChannelProcessor; //导入方法依赖的package包/类
@Override
public void start() {
  Source source = getSource();
  ChannelProcessor cp = source.getChannelProcessor();
  cp.initialize();
  source.start();
  lifecycleState = LifecycleState.START;
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:9,代码来源:EventDrivenSourceRunner.java

示例3: testCensor

import org.apache.flume.channel.ChannelProcessor; //导入方法依赖的package包/类
@Test
public void testCensor() {

  MemoryChannel memCh = new MemoryChannel();
  memCh.configure(new Context());
  memCh.start();

  ChannelSelector cs = new ReplicatingChannelSelector();
  cs.setChannels(Lists.<Channel>newArrayList(memCh));
  ChannelProcessor cp = new ChannelProcessor(cs);

  // source config
  Map<String, String> cfgMap = Maps.newHashMap();
  cfgMap.put("interceptors", "a");
  String builderClass = CensoringInterceptor.Builder.class.getName();
  cfgMap.put("interceptors.a.type", builderClass);
  Context ctx = new Context(cfgMap);

  // setup
  cp.configure(ctx);
  cp.initialize();

  Map<String, String> headers = Maps.newHashMap();
  String badWord = "scribe";
  headers.put("Bad-Words", badWord);
  Event event1 = EventBuilder.withBody("test", Charsets.UTF_8, headers);
  Assert.assertEquals(badWord, event1.getHeaders().get("Bad-Words"));
  cp.processEvent(event1);

  Transaction tx = memCh.getTransaction();
  tx.begin();

  Event event1a = memCh.take();
  Assert.assertNull(event1a.getHeaders().get("Bad-Words"));

  tx.commit();
  tx.close();

  // cleanup / shutdown
  cp.close();
  memCh.stop();
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:43,代码来源:TestCensoringInterceptor.java


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