use of io.cdap.cdap.data2.dataset2.lib.table.inmemory.InMemoryTable in project cdap by caskdata.
the class InMemoryStreamConsumerStateStoreFactory method create.
@Override
public synchronized StreamConsumerStateStore create(StreamConfig streamConfig) throws IOException {
NamespaceId namespace = streamConfig.getStreamId().getParent();
TableId tableId = StreamUtils.getStateStoreTableId(namespace);
InMemoryTableAdmin admin = new InMemoryTableAdmin(DatasetContext.from(tableId.getNamespace()), tableId.getTableName(), cConf);
if (!admin.exists()) {
admin.create();
}
InMemoryTable table = new NoTxInMemoryTable(DatasetContext.from(tableId.getNamespace()), tableId.getTableName(), cConf);
return new InMemoryStreamConsumerStateStore(streamConfig, table);
}
Aggregations