本文整理汇总了Java中org.apache.flume.SinkFactory类的典型用法代码示例。如果您正苦于以下问题:Java SinkFactory类的具体用法?Java SinkFactory怎么用?Java SinkFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SinkFactory类属于org.apache.flume包,在下文中一共展示了SinkFactory类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import org.apache.flume.SinkFactory; //导入依赖的package包/类
@Test
public void test() {
Context context = new Context();
context.put("type", FailoverSinkProcessor.class.getName());
context.put("priority.sink1", "1");
context.put("priority.sink2", "2");
SinkFactory sf = new DefaultSinkFactory();
List<Sink> sinks = new ArrayList<Sink>();
sinks.add(sf.create("sink1", "avro"));
sinks.add(sf.create("sink2", "avro"));
SinkProcessor sp = SinkProcessorFactory.getProcessor(context, sinks);
context.put("type", "failover");
SinkProcessor sp2 = SinkProcessorFactory.getProcessor(context, sinks);
Assert.assertEquals(sp.getClass(), sp2.getClass());
}
示例2: testInstantiatingLoadBalancingSinkProcessor
import org.apache.flume.SinkFactory; //导入依赖的package包/类
@Test
public void testInstantiatingLoadBalancingSinkProcessor() {
Context context = new Context();
context.put("type", LoadBalancingSinkProcessor.class.getName());
context.put("selector", "random");
SinkFactory sf = new DefaultSinkFactory();
List<Sink> sinks = new ArrayList<Sink>();
sinks.add(sf.create("sink1", "avro"));
sinks.add(sf.create("sink2", "avro"));
SinkProcessor sp = SinkProcessorFactory.getProcessor(context, sinks);
context.put("type", "load_balance");
SinkProcessor sp2 = SinkProcessorFactory.getProcessor(context, sinks);
Assert.assertEquals(sp.getClass(), sp2.getClass());
}
示例3: verifySinkCreation
import org.apache.flume.SinkFactory; //导入依赖的package包/类
private void verifySinkCreation(String name, String type, Class<?> typeClass) throws FlumeException {
SinkFactory sinkFactory = new DefaultSinkFactory();
Sink sink = sinkFactory.create(name, type);
Assert.assertNotNull(sink);
Assert.assertTrue(typeClass.isInstance(sink));
}