Search in sources :

Example 1 with LogicalSourceConfig

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();
}
Also used : LogicalSourceConfig(com.linkedin.databus2.relay.config.LogicalSourceConfig) PhysicalSourceConfig(com.linkedin.databus2.relay.config.PhysicalSourceConfig) LogicalSourceConfig(com.linkedin.databus2.relay.config.LogicalSourceConfig) PhysicalSourceStaticConfig(com.linkedin.databus2.relay.config.PhysicalSourceStaticConfig) PhysicalSourceConfig(com.linkedin.databus2.relay.config.PhysicalSourceConfig) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with LogicalSourceConfig

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);
}
Also used : PhysicalSourceConfig(com.linkedin.databus2.relay.config.PhysicalSourceConfig) LogicalSourceConfig(com.linkedin.databus2.relay.config.LogicalSourceConfig) DatabusRelaySourcesInFiles(com.linkedin.databus2.relay.config.DatabusRelaySourcesInFiles) FileSystemSchemaRegistryService(com.linkedin.databus2.schemas.FileSystemSchemaRegistryService) File(java.io.File) VersionedSchema(com.linkedin.databus2.schemas.VersionedSchema)

Example 3 with LogicalSourceConfig

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());
}
Also used : PhysicalSourceConfig(com.linkedin.databus2.relay.config.PhysicalSourceConfig) LogicalSourceConfig(com.linkedin.databus2.relay.config.LogicalSourceConfig) PhysicalSourceStaticConfig(com.linkedin.databus2.relay.config.PhysicalSourceStaticConfig)

Example 4 with LogicalSourceConfig

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);
}
Also used : LogicalSourceConfig(com.linkedin.databus2.relay.config.LogicalSourceConfig)

Example 5 with LogicalSourceConfig

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;
}
Also used : PhysicalSourceStaticConfig(com.linkedin.databus2.relay.config.PhysicalSourceStaticConfig) PhysicalSourceConfig(com.linkedin.databus2.relay.config.PhysicalSourceConfig) LogicalSourceConfig(com.linkedin.databus2.relay.config.LogicalSourceConfig) DatabusRelayMain(com.linkedin.databus2.relay.DatabusRelayMain)

Aggregations

LogicalSourceConfig (com.linkedin.databus2.relay.config.LogicalSourceConfig)12 PhysicalSourceConfig (com.linkedin.databus2.relay.config.PhysicalSourceConfig)10 PhysicalSourceStaticConfig (com.linkedin.databus2.relay.config.PhysicalSourceStaticConfig)4 File (java.io.File)4 FileSystemSchemaRegistryService (com.linkedin.databus2.schemas.FileSystemSchemaRegistryService)3 BootstrapConfig (com.linkedin.databus.bootstrap.common.BootstrapConfig)2 BootstrapReadOnlyConfig (com.linkedin.databus.bootstrap.common.BootstrapReadOnlyConfig)2 ConfigLoader (com.linkedin.databus.core.util.ConfigLoader)2 InvalidConfigException (com.linkedin.databus.core.util.InvalidConfigException)2 OracleTriggerMonitoredSourceInfo (com.linkedin.databus2.producers.db.OracleTriggerMonitoredSourceInfo)2 OracleEventProducerFactory (com.linkedin.databus2.relay.OracleEventProducerFactory)2 SchemaRegistryStaticConfig (com.linkedin.databus2.schemas.SchemaRegistryStaticConfig)2 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)2 Test (org.testng.annotations.Test)2 HttpRelay (com.linkedin.databus.container.netty.HttpRelay)1 Checkpoint (com.linkedin.databus.core.Checkpoint)1 DbusEventBuffer (com.linkedin.databus.core.DbusEventBuffer)1 DbusEventKey (com.linkedin.databus.core.DbusEventKey)1 LogicalSource (com.linkedin.databus.core.data_model.LogicalSource)1 BackoffTimerStaticConfigBuilder (com.linkedin.databus2.core.BackoffTimerStaticConfigBuilder)1