Examples of PhysicalSourceConfig


Examples of com.linkedin.databus2.relay.config.PhysicalSourceConfig

    DatabusRelayMain relay = null;
    try
    {
      final short srcId = 104;
      final String srcName = "foo";
      PhysicalSourceConfig pConfig = new PhysicalSourceConfig();
      pConfig.setId(srcId);
      pConfig.setName(srcName);
      pConfig.setUri("mock");
      short lid = (short) (srcId + 1);
      LogicalSourceConfig lConf = new LogicalSourceConfig();
      lConf.setId(lid);
      lConf.setName(srcName);
      // this is table name in the oracle source world
      lConf.setUri(srcName);
      lConf.setPartitionFunction("constant:1");
      pConfig.addSource(lConf);
      int relayPort = Utils.getAvailablePort(11994);
      final int relayId = 666;
      HttpRelay.Config httpRelayConfig = new HttpRelay.Config();
      ServerContainer.Config containerConfig = DatabusRelayTestUtil.createContainerConfig(relayId, relayPort);
      DbusEventBuffer.Config bufferConfig = DatabusRelayTestUtil.createBufferConfig(
          10000, 250, 100);
      httpRelayConfig.setContainer(containerConfig);
      httpRelayConfig.setEventBuffer(bufferConfig);
      httpRelayConfig.setStartDbPuller("true");
      PhysicalSourceStaticConfig[] pStaticConfigs = new PhysicalSourceStaticConfig[1];
      for (LogicalSourceConfig lsc : pConfig.getSources())
      {
        httpRelayConfig.setSourceName("" + lsc.getId(), lsc.getName());
      }
      pStaticConfigs[0] = pConfig.build();
      relay = new DatabusRelayMain(httpRelayConfig.build(), pStaticConfigs);

      relay.start();

      // Insert one event into the relay.
View Full Code Here

Examples of com.linkedin.databus2.relay.config.PhysicalSourceConfig

    {
      String srcName = "com.linkedin.events.example.Settings";

      // create main relay with random generator
      int eventRatePerSec = 10;
      PhysicalSourceConfig srcConfig = DatabusRelayTestUtil.createPhysicalConfigBuilder(
            (short) 1, DatabusRelayTestUtil.getPhysicalSrcName(srcName), "mock",
            500, eventRatePerSec, new String[] {srcName});

      int relayPort = 11995;
      DatabusRelayMain relay = DatabusRelayTestUtil.createDatabusRelayWithSchemaReg(1001, relayPort,
View Full Code Here

Examples of com.linkedin.databus2.relay.config.PhysicalSourceConfig

  "}";

  public PhysicalSourceConfig convertToPhysicalSourceConfig(String str) {
    _mapper = new ObjectMapper();
    InputStreamReader isr = new InputStreamReader(IOUtils.toInputStream(str));
    PhysicalSourceConfig pConfig = null;
    try
    {
      pConfig = _mapper.readValue(isr, PhysicalSourceConfig.class);
    }
    catch (JsonParseException e) {
View Full Code Here

Examples of com.linkedin.databus2.relay.config.PhysicalSourceConfig

    TestSetup() throws JsonParseException, JsonMappingException, IOException, InvalidConfigException
    {
      ObjectMapper mapper = new ObjectMapper();
      InputStreamReader isr = new InputStreamReader(IOUtils.toInputStream(_configSource1));

      PhysicalSourceConfig pConfig1 = mapper.readValue(isr, PhysicalSourceConfig.class);

      isr.close();
      isr = new InputStreamReader(IOUtils.toInputStream(_configSource2));
      PhysicalSourceConfig pConfig2 = mapper.readValue(isr, PhysicalSourceConfig.class);

      PhysicalSourceStaticConfig pStatConf1 = pConfig1.build();
      PhysicalSourceStaticConfig pStatConf2 = pConfig2.build();

      _physConfigs =  new PhysicalSourceStaticConfig [] {pStatConf1, pStatConf2};

      DbusEventBuffer.Config conf = new DbusEventBuffer.Config();
      conf.setAllocationPolicy("MMAPPED_MEMORY");
View Full Code Here

Examples of com.linkedin.databus2.relay.config.PhysicalSourceConfig

    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);
View Full Code Here

Examples of com.linkedin.databus2.relay.config.PhysicalSourceConfig

  public void deserializePhysicalSourceConfigWithEbuffer() throws JSONException, JsonParseException, JsonMappingException, IOException
  {
    JSONObject jsonObject = new JSONObject(PhysicalSourcesConfigWithEBuffer.toString());
    Assert.assertNotEquals(jsonObject.get("dbusEventBuffer"), JSONObject.NULL);
    ObjectMapper mapper = new ObjectMapper();
    PhysicalSourceConfig config = mapper.readValue(jsonObject.toString(), PhysicalSourceConfig.class);
    //System.out.println(config.toString());
    Assert.assertEquals(config.isDbusEventBufferSet(), true);
  }
View Full Code Here

Examples of com.linkedin.databus2.relay.config.PhysicalSourceConfig

      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());
    }
View Full Code Here

Examples of com.linkedin.databus2.relay.config.PhysicalSourceConfig

  public void deserializePhysicalSourceConfigWithoutEbuffer() throws JSONException, JsonParseException, JsonMappingException, IOException
  {
    JSONObject jsonObject = new JSONObject(PhysicalSourcesConfigWithoutEBuffer.toString());
    Assert.assertEquals(jsonObject.get("dbusEventBuffer"), JSONObject.NULL);
    ObjectMapper mapper = new ObjectMapper();
    PhysicalSourceConfig config = mapper.readValue(jsonObject.toString(), PhysicalSourceConfig.class);
    Assert.assertEquals(config.isDbusEventBufferSet(), false);
  }
View Full Code Here

Examples of com.linkedin.databus2.relay.config.PhysicalSourceConfig

        int i = 0;
        for (String file : _physicalSrcConfigFiles) {
            LOG.info("processing file: " + file);
            File sourcesJson = new File(file);
            PhysicalSourceConfig pConfig = mapper.readValue(sourcesJson, PhysicalSourceConfig.class);
            pConfig.checkForNulls();
            _pStaticConfigs[i] = pConfig.build();

            // Register all sources with the static config
            //TODO why do we need this?
            for (LogicalSourceConfig lsc : pConfig.getSources()) {
                _relayConfigBuilder.setSourceName(Short.toString(lsc.getId()), lsc.getName());
            }
            i++;
        }
      }
View Full Code Here

Examples of com.linkedin.databus2.relay.config.PhysicalSourceConfig

        return _dataSources;
      }

      public PhysicalSourceConfig getPhysicalSourcesConfigs(int index)
      {
        while (_physicalSourcesConfigs.size() <= index) _physicalSourcesConfigs.add(new PhysicalSourceConfig());
        return _physicalSourcesConfigs.get(index);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.