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


Java ISpoutOutputCollector类代码示例

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


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

示例1: testBatchEmit

import backtype.storm.spout.ISpoutOutputCollector; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes"})
@Test
public void testBatchEmit() throws IllegalArgumentException, IllegalAccessException {
	TopologyContext context = mock(TopologyContext.class);
	ISpoutOutputCollector col = mock(ISpoutOutputCollector.class);
	BatchSpoutOutputCollector collector = new BatchSpoutOutputCollector(context, col, 0);
	
	SpoutBatchCollectorImpl collectorImpl = new SpoutBatchCollectorImpl(collector, context, 0);
	
	String streamId = new String();
	Batch batch = mock(Batch.class);
	Object messageId = mock(Object.class);
	
	collector.batchEmitted = false;
	collectorImpl.doEmit(streamId, null, batch, messageId);
	
	verify(col).emit(streamId, (List)batch, messageId);
	Assert.assertTrue(collector.batchEmitted);
}
 
开发者ID:mjsax,项目名称:aeolus,代码行数:20,代码来源:SpoutBatchCollectorImplTest.java

示例2: batchEmitDirect

import backtype.storm.spout.ISpoutOutputCollector; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes"})
@Test
public void batchEmitDirect() throws IllegalArgumentException, IllegalAccessException {
	TopologyContext context = mock(TopologyContext.class);
	ISpoutOutputCollector col = mock(ISpoutOutputCollector.class);
	BatchSpoutOutputCollector collector = new BatchSpoutOutputCollector(context, col, 0);
	
	SpoutBatchCollectorImpl collectorImpl = new SpoutBatchCollectorImpl(collector, context, 0);
	
	int taskId = 0;
	String streamId = new String();
	Batch batch = mock(Batch.class);
	Object messageId = mock(Object.class);
	
	collector.batchEmitted = false;
	collectorImpl.doEmitDirect(taskId, streamId, null, batch, messageId);
	
	verify(col).emitDirect(taskId, streamId, (List)batch, messageId);
	Assert.assertTrue(collector.batchEmitted);
}
 
开发者ID:mjsax,项目名称:aeolus,代码行数:21,代码来源:SpoutBatchCollectorImplTest.java

示例3: getOutputCollector

import backtype.storm.spout.ISpoutOutputCollector; //导入依赖的package包/类
public ISpoutOutputCollector getOutputCollector() {
	return collector;
}
 
开发者ID:JamesLampton,项目名称:piggybank-squeal,代码行数:4,代码来源:SourceOutputCollector.java

示例4: newInstance

import backtype.storm.spout.ISpoutOutputCollector; //导入依赖的package包/类
public static SpoutOutputCollector newInstance(ISpoutOutputCollector obj) {			
	return new SpoutOutputCollector(new AutoIDCollector(obj));
}
 
开发者ID:JamesLampton,项目名称:piggybank-squeal,代码行数:4,代码来源:SpoutWrapperUtils.java

示例5: AutoIDCollector

import backtype.storm.spout.ISpoutOutputCollector; //导入依赖的package包/类
public AutoIDCollector (ISpoutOutputCollector obj) {
	super();
	proxied = obj;
	_rand = new Random();
}
 
开发者ID:JamesLampton,项目名称:piggybank-squeal,代码行数:6,代码来源:SpoutWrapperUtils.java

示例6: invoke

import backtype.storm.spout.ISpoutOutputCollector; //导入依赖的package包/类
@Override
		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
//			log.info(method.getName());
//			if (args != null) {
//				log.info(Arrays.asList(args));
//			}
			
			if (method.getName().equals("open")) {
				// FIXME: Check on emit and determine if we need to intercept and
				// provide a default id mechanism.
				
				// Pull any override values.
				Map conf = (Map) args[0];
				if (conf.containsKey(CONF_OVERRIDE)) {
					resource_count = Integer.parseInt((String) conf.get(CONF_OVERRIDE));
				}
				
				// Replace the collector
				args[2] = AutoIDCollector.newInstance((ISpoutOutputCollector) args[2]);

				log.info("Configuring " + resource_count + " oustanding resources for consumption.");

				// Initialize our resource semaphore.
				resources = new Semaphore(resource_count);
			} else if (method.getName().equals("nextTuple")) {
				// Attempt to acquire some resources.
				if (!resources.tryAcquire()) {
					// No free resources, bounce.
					return null;
				}
//				log.info("ACQUIRED");
			} else if (method.getName().equals("ack") || method.getName().equals("fail")) {
//				log.info("RELEASE");
				// Release a resource.
				resources.release();
				
				if (args[0] != null && args[0] instanceof AutoID) {
					args[0] = null;
				}
			}
			
			return method.invoke(proxied, args);
		}
 
开发者ID:JamesLampton,项目名称:piggybank-squeal,代码行数:44,代码来源:SpoutWrapperUtils.java

示例7: FakeSpoutOutputCollector

import backtype.storm.spout.ISpoutOutputCollector; //导入依赖的package包/类
public FakeSpoutOutputCollector(ISpoutOutputCollector delegate) {
    super(delegate);
}
 
开发者ID:elastacloud,项目名称:servicebusspout,代码行数:4,代码来源:FakeSpoutOutputCollector.java

示例8: BatchSpoutOutputCollector

import backtype.storm.spout.ISpoutOutputCollector; //导入依赖的package包/类
/**
 * Instantiates a new {@link BatchSpoutOutputCollector} for the given batch size.
 * 
 * @param context
 *            The current runtime environment.
 * @param collector
 *            The original collector object.
 * @param batchSizes
 *            The batch sizes for each output stream.
 */
public BatchSpoutOutputCollector(TopologyContext context, ISpoutOutputCollector collector,
	Map<String, Integer> batchSizes) {
	super(collector);
	this.collector = collector;
	this.batcher = new SpoutBatchCollectorImpl(this, context, batchSizes);
}
 
开发者ID:mjsax,项目名称:aeolus,代码行数:17,代码来源:BatchSpoutOutputCollector.java


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