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


Java Sink.setName方法代码示例

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


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

示例1: create

import org.apache.flume.Sink; //导入方法依赖的package包/类
@Override
public Sink create(String name, String type) throws FlumeException {
  Preconditions.checkNotNull(name, "name");
  Preconditions.checkNotNull(type, "type");
  logger.info("Creating instance of sink: {}, type: {}", name, type);
  Class<? extends Sink> sinkClass = getClass(type);
  try {
    Sink sink = sinkClass.newInstance();
    sink.setName(name);
    return sink;
  } catch (Exception ex) {
    throw new FlumeException("Unable to create sink: " + name
        + ", type: " + type + ", class: " + sinkClass.getName(), ex);
  }
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:16,代码来源:DefaultSinkFactory.java

示例2: testIRCSinkMissingSplitLineProperty

import org.apache.flume.Sink; //导入方法依赖的package包/类
@Test
public void testIRCSinkMissingSplitLineProperty() {
  Sink ircSink = new IRCSink();
  ircSink.setName("IRC Sink - " + UUID.randomUUID().toString());
  Context context = new Context();
  context.put("hostname", "localhost");
  context.put("port", String.valueOf(ircServerPort));
  context.put("nick", "flume");
  context.put("password", "flume");
  context.put("user", "flume");
  context.put("name", "flume-dev");
  context.put("chan", "flume");
  context.put("splitchars", "false");
  Configurables.configure(ircSink, context);
  Channel memoryChannel = new MemoryChannel();
  Configurables.configure(memoryChannel, context);
  ircSink.setChannel(memoryChannel);
  ircSink.start();
  Transaction txn = memoryChannel.getTransaction();
  txn.begin();
  Event event = EventBuilder.withBody("Dummy Event".getBytes());
  memoryChannel.put(event);
  txn.commit();
  txn.close();
  try {
    Sink.Status status = ircSink.process();
    if (status == Sink.Status.BACKOFF) {
      fail("Error occured");
    }
  } catch (EventDeliveryException eDelExcp) {
    // noop
  }
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:34,代码来源:TestIRCSink.java


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