use of com.linkedin.databus2.relay.config.LogicalSourceConfig in project databus by linkedin.
the class TestDbusPhysicalPartitionEventBuffer method setUp.
@BeforeClass
public void setUp() throws InvalidConfigException {
LogicalSourceConfig loConfig = new LogicalSourceConfig();
loConfig.setId((short) 0);
loConfig.setName("testlogicalName");
loConfig.setPartition((short) 0);
loConfig.setUri("testuri");
loConfig.setPartitionFunction("constant:1");
//Physical sources config without event buffer
PhysicalSourceConfig config = new PhysicalSourceConfig();
config.setName("testname");
config.setUri("testuri");
config.setSource(0, loConfig);
PhysicalSourcesStaticConfigWithoutEbuffer = config.build();
PhysicalSourcesConfigWithoutEBuffer = config;
//Physical sources config with event buffer
PhysicalSourceConfig config2 = new PhysicalSourceConfig();
config2.setName("testname");
config2.setUri("testuri");
config2.setSource(0, loConfig);
config2.setName("testname");
config2.setUri("testuri");
config2.getDbusEventBuffer().setMaxSize(eventBufferMaxSize);
config2.getDbusEventBuffer().setScnIndexSize(scnIndexSize);
config2.getDbusEventBuffer().setAverageEventSize(eventBufferReadBufferSize);
PhysicalSourcesStaticConfigWithEBuffer = config2.build();
PhysicalSourcesConfigWithEBuffer = config2;
//Global event buffer config
DbusEventBuffer.Config ebufConfig = new DbusEventBuffer.Config();
ebufConfig.setMaxSize(globaleventBufferMaxSize);
GlobalDbusEbufferStaticConfig = ebufConfig.build();
}
use of com.linkedin.databus2.relay.config.LogicalSourceConfig in project databus by linkedin.
the class DevRelayConfigGenerator method generateRelayConfig.
public static void generateRelayConfig(String schemaRegistryLocation, String dbName, String uri, String outputDir, List<String> srcNames, SchemaMetaDataManager manager) throws Exception {
PhysicalSourceConfig config = new PhysicalSourceConfig();
FileSystemSchemaRegistryService s = FileSystemSchemaRegistryService.build(new FileSystemSchemaRegistryService.StaticConfig(new File(schemaRegistryLocation), 0, false, false));
dbName = dbName.trim().toLowerCase();
config.setName(dbName);
config.setUri(uri);
for (String srcName : srcNames) {
VersionedSchema schema = null;
schema = s.fetchLatestVersionedSchemaBySourceName(srcName);
String dbObjectName = SchemaHelper.getMetaField(schema.getSchema(), "dbFieldName");
LogicalSourceConfig c = new LogicalSourceConfig();
c.setId(manager.getSrcId(srcName));
c.setName(srcName);
c.setUri(dbName + "." + dbObjectName);
c.setPartitionFunction("constant:1");
config.addSource(c);
}
DatabusRelaySourcesInFiles relaySourcesInFiles = new DatabusRelaySourcesInFiles(outputDir);
relaySourcesInFiles.add(dbName, config);
boolean success = relaySourcesInFiles.save();
if (!success)
throw new RuntimeException("Unable to create the dev relay config for DB :" + dbName);
}
use of com.linkedin.databus2.relay.config.LogicalSourceConfig in project databus by linkedin.
the class HttpRelay method initPConfigs.
// create a "fake" configuration for backward compatiblity - in case a new configuration is not available
private void initPConfigs(HttpRelay.StaticConfig config) throws InvalidConfigException {
if (_pConfigs != null)
return;
StringBuilder logListIds = new StringBuilder("Creating default physical source config. Sources are: ");
// default ph config
PhysicalSourceConfig pConfig = PhysicalSourceConfig.createFromLogicalSources(_sourcesIdNameRegistry.getAllSources());
//
for (LogicalSourceConfig ls : pConfig.getSources()) logListIds.append(ls.getId() + ":" + ls.getName() + ",");
LOG.info(logListIds);
// set the memeber
_pConfigs = new ArrayList<PhysicalSourceStaticConfig>(1);
_pConfigs.add(pConfig.build());
}
use of com.linkedin.databus2.relay.config.LogicalSourceConfig in project databus by linkedin.
the class DatabusRelayTestUtil method createPhysicalConfigBuilder.
/**
* Convenience class to create configs for relays
*
* @param id
* @param name
* @param uri
* @param pollIntervalMs
* @param eventRatePerSec
* @param restartScnOffset
* @param largestEventSize
* @param largestWindowSize
* @param logicalSources
* @return
*/
public static PhysicalSourceConfig createPhysicalConfigBuilder(short id, String name, String uri, long pollIntervalMs, int eventRatePerSec, long restartScnOffset, int largestEventSize, long largestWindowSize, String[] logicalSources) {
LogicalSourceConfig[] lSourceConfigs = new LogicalSourceConfig[logicalSources.length];
short lid = (short) (id + 1);
int i = 0;
for (String schemaName : logicalSources) {
LogicalSourceConfig lConf = new LogicalSourceConfig();
lConf.setId(lid++);
lConf.setName(schemaName);
// this is table name in the oracle source world
lConf.setUri(schemaName);
lConf.setPartitionFunction("constant:1");
lSourceConfigs[i] = lConf;
i++;
}
return createPhysicalConfigBuilder(id, name, uri, pollIntervalMs, eventRatePerSec, restartScnOffset, largestEventSize, largestWindowSize, lSourceConfigs);
}
use of com.linkedin.databus2.relay.config.LogicalSourceConfig in project databus by linkedin.
the class DatabusRelayTestUtil method createDatabusRelay.
public static DatabusRelayMain createDatabusRelay(PhysicalSourceConfig[] sourceConfigs, HttpRelay.Config httpRelayConfig) throws IOException, DatabusException {
PhysicalSourceStaticConfig[] pStaticConfigs = new PhysicalSourceStaticConfig[sourceConfigs.length];
int i = 0;
for (PhysicalSourceConfig pConf : sourceConfigs) {
// prefixed to the id or what?
for (LogicalSourceConfig lsc : pConf.getSources()) {
httpRelayConfig.setSourceName("" + lsc.getId(), lsc.getName());
}
pStaticConfigs[i++] = pConf.build();
}
DatabusRelayMain relayMain = new DatabusRelayMain(httpRelayConfig.build(), pStaticConfigs);
return relayMain;
}
Aggregations