本文整理汇总了Java中com.datatorrent.api.Context.OperatorContext.getId方法的典型用法代码示例。如果您正苦于以下问题:Java OperatorContext.getId方法的具体用法?Java OperatorContext.getId怎么用?Java OperatorContext.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.datatorrent.api.Context.OperatorContext
的用法示例。
在下文中一共展示了OperatorContext.getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
// Needed to setup idempotency storage manager in setter
this.context = context;
this.operatorContextId = context.getId();
try {
connFactory.setHost("localhost");
connection = connFactory.newConnection();
channel = connection.createChannel();
channel.exchangeDeclare(exchange, "fanout");
this.windowDataManager.setup(context);
} catch (IOException ex) {
logger.debug(ex.toString());
DTThrowable.rethrow(ex);
}
}
示例2: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
/**
* At setup time, init last completed windowId from maxWindowTable
*
* @param context
*/
@Override
public void setup(OperatorContext context)
{
operatorId = context.getId();
try {
mongoClient = new MongoClient(hostName);
db = mongoClient.getDB(dataBase);
if (userName != null && passWord != null) {
db.authenticate(userName, passWord.toCharArray());
}
initLastWindowInfo();
for (String table : tableList) {
tableToDocumentList.put(table, new ArrayList<DBObject>());
tableToDocument.put(table, new BasicDBObject());
}
} catch (UnknownHostException ex) {
logger.debug(ex.toString());
}
}
示例3: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
logger.debug("consumer {} topic {} cacheSize {}", consumer, consumer.getTopic(), consumer.getCacheSize());
consumer.create();
// reset the offsets to checkpointed one
if (consumer instanceof SimpleKafkaConsumer && !offsetStats.isEmpty()) {
Map<KafkaPartition, Long> currentOffsets = new HashMap<>();
// Increment the offsets and set it to consumer
for (Map.Entry<KafkaPartition, Long> e: offsetStats.entrySet()) {
currentOffsets.put(e.getKey(), e.getValue() + 1);
}
((SimpleKafkaConsumer)consumer).resetOffset(currentOffsets);
}
this.context = context;
operatorId = context.getId();
if (consumer instanceof HighlevelKafkaConsumer && !(windowDataManager instanceof WindowDataManager.NoopWindowDataManager)) {
throw new RuntimeException("Idempotency is not supported for High Level Kafka Consumer");
}
windowDataManager.setup(context);
}
示例4: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
String appId = context.getValue(DAG.APPLICATION_ID);
operatorId = context.getId();
outputFilePath = File.separator + appId + File.separator + operatorId;
super.setup(context);
}
示例5: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
long windowDurationMillis = context.getValue(OperatorContext.APPLICATION_WINDOW_COUNT) *
context.getValue(Context.DAGContext.STREAMING_WINDOW_SIZE_MILLIS);
maxEventsPerWindow = (long)(windowDurationMillis / 1000.0 * maxEventsPerSecond);
logger.debug("max-events per-second {} per-window {}", maxEventsPerSecond, maxEventsPerWindow);
try {
eventloop = new DefaultEventLoop("EventLoop-" + context.getId());
eventloop.start();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
示例6: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
/**
* Implement Component Interface.
*
* @param context
*/
@Override
public void setup(OperatorContext context)
{
this.context = context;
try {
KinesisUtil.getInstance().createKinesisClient(accessKey, secretKey, endPoint);
} catch (Exception e) {
throw new RuntimeException(e);
}
consumer.create();
operatorId = context.getId();
windowDataManager.setup(context);
shardPosition.clear();
}
示例7: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
this.operatorContextId = context.getId();
holdingBuffer = new ArrayBlockingQueue<KeyValPair<Long, byte[]>>(bufferSize);
this.windowDataManager.setup(context);
}
示例8: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
super.setup(context);
mode = context.getValue(OperatorContext.PROCESSING_MODE);
if (mode == ProcessingMode.AT_MOST_ONCE) {
//Batch must be cleared to avoid writing same data twice
tuples.clear();
}
try {
for (T tempTuple: tuples) {
setStatementParameters(updateCommand, tempTuple);
updateCommand.addBatch();
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
appId = context.getValue(DAG.APPLICATION_ID);
operatorId = context.getId();
//Get the last completed window.
committedWindowId = store.getCommittedWindowId(appId, operatorId);
LOG.debug("AppId {} OperatorId {}", appId, operatorId);
LOG.debug("Committed window id {}", committedWindowId);
}
示例9: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
try {
store.connect();
appId = context.getValue(DAG.APPLICATION_ID);
operatorId = context.getId();
committedWindowId = store.getCommittedWindowId(appId, operatorId);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
示例10: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext ctxt)
{
operatorId = ctxt.getId();
appId = ctxt.getValue(DAGContext.APPLICATION_ID);
String v = get(getEndWindowKey());
if (v != null) {
committedWindowId = Long.valueOf(v);
}
}
示例11: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
operatorId = context.getId();
globalProcessedFileCount.setValue(processedFiles.size());
LOG.debug("Setup processed file count: {}", globalProcessedFileCount);
this.context = context;
try {
filePath = new Path(directory);
configuration = new Configuration();
fs = getFSInstance();
} catch (IOException ex) {
failureHandling(ex);
}
fileCounters.setCounter(FileCounters.GLOBAL_PROCESSED_FILES, globalProcessedFileCount);
fileCounters.setCounter(FileCounters.LOCAL_PROCESSED_FILES, localProcessedFileCount);
fileCounters.setCounter(FileCounters.GLOBAL_NUMBER_OF_FAILURES, globalNumberOfFailures);
fileCounters.setCounter(FileCounters.LOCAL_NUMBER_OF_FAILURES, localNumberOfFailures);
fileCounters.setCounter(FileCounters.GLOBAL_NUMBER_OF_RETRIES, globalNumberOfRetries);
fileCounters.setCounter(FileCounters.LOCAL_NUMBER_OF_RETRIES, localNumberOfRetries);
fileCounters.setCounter(FileCounters.PENDING_FILES, pendingFileCount);
windowDataManager.setup(context);
if (context.getValue(OperatorContext.ACTIVATION_WINDOW_ID) < windowDataManager.getLargestCompletedWindow()) {
//reset current file and offset in case of replay
currentFile = null;
offset = 0;
}
}
示例12: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
/**
* Initializing current partition id, partitionedFileName etc. {@inheritDoc}
*/
@Override
public void setup(OperatorContext context)
{
super.setup(context);
physicalPartitionId = context.getId();
if (StringUtils.isEmpty(partitionedFileNameformat)) {
partitionedFileName = outputFileName;
} else {
partitionedFileName = String.format(partitionedFileNameformat, outputFileName, physicalPartitionId);
}
}
示例13: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
if (PubSubHelper.isGatewayConfigured(context)) {
wsoo.setUri(PubSubHelper.getURI(context));
wsoo.setup(context);
} else {
isWebSocketConnected = false;
coo.setup(context);
}
appId = context.getValue(DAG.APPLICATION_ID);
operId = context.getId();
}
示例14: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
this.operatorId = context.getId();
}
示例15: setup
import com.datatorrent.api.Context.OperatorContext; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context)
{
super.setup(context);
id = context.getId();
}