Examples of DbusKeyCompositeFilterConfig


Examples of com.linkedin.databus2.core.filter.DbusKeyCompositeFilterConfig

  @Test
  public void testRelayPullerThreadV3WithFilter() throws Exception
  {
    RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, false);
    // create filter
    DbusKeyCompositeFilterConfig filterConfig = createFakeFilter();
    bldr.setFilterConfig(filterConfig);
    RelayPullThread relayPuller = bldr.createRelayPullThread();
    relayPuller.getComponentStatus().start();
    ConnectionState connState = relayPuller.getConnectionState();
    connState.switchToPickServer();
    testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);

    // get the created connection
    MockRelayConnection conn = (MockRelayConnection) relayPuller.getLastOpenConnection();
    conn.setProtocolVersion(3);
    relayPuller.getMessageQueue().clear();
    testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_RESPONSE_SUCCESS);
    relayPuller.getMessageQueue().clear();
    testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.REQUEST_REGISTER);
    relayPuller.getMessageQueue().clear();
    testTransitionCase(relayPuller, StateId.REQUEST_REGISTER, StateId.REGISTER_RESPONSE_SUCCESS);
    relayPuller.getMessageQueue().clear();
    testTransitionCase(relayPuller, StateId.REGISTER_RESPONSE_SUCCESS, StateId.REQUEST_STREAM);
    relayPuller.getMessageQueue().clear();
    testTransitionCase(relayPuller, StateId.REQUEST_STREAM, StateId.STREAM_REQUEST_SUCCESS);


    DbusKeyCompositeFilter filter = conn.getRelayFilter();
    Assert.assertNotNull(filter);
    // get DbusKeyFilter that we put in
    KeyFilterConfigHolder configHolder = filterConfig.getConfigMap().values().iterator().next();
    DbusKeyFilter inFilter = new DbusKeyFilter(configHolder);

    // get filter from the connection
    Assert.assertEquals(filter.getFilterMap().size(), 1, "1 filter in the composite filter");
    Assert.assertTrue(filter.getFilterMap().entrySet().iterator().hasNext(), "has one filter");
View Full Code Here

Examples of com.linkedin.databus2.core.filter.DbusKeyCompositeFilterConfig

    List<DbusKeyCompositeFilterConfig> relayFilterConfigs = new ArrayList<DbusKeyCompositeFilterConfig>();
    List<DbusKeyCompositeFilterConfig> bootstrapFilterConfigs = new ArrayList<DbusKeyCompositeFilterConfig>();

    if (null != registrations) {
      for (DatabusV2ConsumerRegistration reg : registrations) {
        DbusKeyCompositeFilterConfig conf = reg.getFilterConfig();

        if (null != conf)
          relayFilterConfigs.add(conf);
      }
    }

    if (null != bootstrapRegistrations) {
      for (DatabusV2ConsumerRegistration reg : bootstrapRegistrations) {
        DbusKeyCompositeFilterConfig conf = reg.getFilterConfig();

        if (null != conf)
          bootstrapFilterConfigs.add(conf);
      }
    }
View Full Code Here

Examples of com.linkedin.databus2.core.filter.DbusKeyCompositeFilterConfig

      }
      bootstrapBuilder.setSources(sourcesString.toString());
    }

    // handler server side filtering, can either pass a config file or set from command line
    DbusKeyCompositeFilterConfig filterConfig = createServerSideFilterConfig(_filterConfFile, startupProps);

    // set up listeners
    DatabusHttpClientImpl client = new DatabusHttpClientImpl(clientConfig);

    // dump decoded payload values and raw (undecoded) events
View Full Code Here

Examples of com.linkedin.databus2.core.filter.DbusKeyCompositeFilterConfig

      DbusKeyCompositeFilterConfig.Config conf = new DbusKeyCompositeFilterConfig.Config();
      ConfigLoader<DbusKeyCompositeFilterConfig.StaticConfig> filterConfigLoader =
        new ConfigLoader<DbusKeyCompositeFilterConfig.StaticConfig>(SERVER_SIDE_FILTER_PREFIX, conf);
      DbusKeyCompositeFilterConfig.StaticConfig sConf = filterConfigLoader.loadConfig(props);

      return new DbusKeyCompositeFilterConfig(sConf);
    }
    else
    {
      return null;
    }
View Full Code Here

Examples of com.linkedin.databus2.core.filter.DbusKeyCompositeFilterConfig

        return;
      }

      // Call factories to get consumer callbacks and server-side filter config.
      Collection<DatabusCombinedConsumer> consumers = _consumerFactory.createPartitionedConsumers(_clusterInfo, partition);
      DbusKeyCompositeFilterConfig filterConfig = null;

      if (_serverSideFilterFactory != null)
        filterConfig = _serverSideFilterFactory.createServerSideFilter(_clusterInfo, partition);

View Full Code Here

Examples of com.linkedin.databus2.core.filter.DbusKeyCompositeFilterConfig

                                                             cli.getOut()); break;
      default: throw new InvalidConfigException("unsupported output format: " + cli.getOutputFormat());
      }
    }

    DbusKeyCompositeFilterConfig filterConfig = null;

    if (_cli.getModPartBase() > 0)
    {
      DbusKeyCompositeFilterConfig.Config builder = new DbusKeyCompositeFilterConfig.Config();
      for (String src: cli.getSources())
      {
        builder.getFilter(src).setType(PartitionType.MOD.toString());
        builder.getFilter(src).getMod().setNumBuckets(cli.getModPartBase());
        builder.getFilter(src).getMod().setBuckets(cli.getModPartIds());
      }
      filterConfig = new DbusKeyCompositeFilterConfig(builder.build());
    }

    _client.registerDatabusStreamListener(_consumer, filterConfig, cli.getSources());
    _client.registerDatabusBootstrapListener(_consumer, filterConfig, cli.getSources());
View Full Code Here

Examples of com.linkedin.databus2.core.filter.DbusKeyCompositeFilterConfig

        filterConfig.getMod().setNumBuckets(cluster.getNumTotalPartitions());
        filterConfig.getMod().setBuckets("[" + partition.getPartitionId() + "]");
        compositeConfig.setFilter(s.getLogicalSource().getName(), filterConfig);
    }
   
    DbusKeyCompositeFilterConfig c = new DbusKeyCompositeFilterConfig(compositeConfig.build());
    LOG.info("Generated Mod Partitioned Config for partition (" + partition + ") of cluster (" + cluster + ") is :" + c);
    return c;
  }
View Full Code Here

Examples of com.linkedin.databus2.core.filter.DbusKeyCompositeFilterConfig

        filterConfig.getRange().setSize(_rangeWidth);
        filterConfig.getRange().setPartitions("[" + partition.getPartitionId() + "]");
        compositeConfig.setFilter(s.getLogicalSource().getName(), filterConfig);
    }
   
    DbusKeyCompositeFilterConfig c = new DbusKeyCompositeFilterConfig(compositeConfig.build());
    LOG.info("Generated Mod Partitioned Config for partition (" + partition + ") of cluster (" + cluster + ") is :" + c);
    return c;
 
  }
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.