当前位置: 首页>>代码示例>>Java>>正文


Java DistributerConsumer类代码示例

本文整理汇总了Java中dk.dma.ais.bus.consumer.DistributerConsumer的典型用法代码示例。如果您正苦于以下问题:Java DistributerConsumer类的具体用法?Java DistributerConsumer怎么用?Java DistributerConsumer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DistributerConsumer类属于dk.dma.ais.bus.consumer包,在下文中一共展示了DistributerConsumer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startAisBus

import dk.dma.ais.bus.consumer.DistributerConsumer; //导入依赖的package包/类
private void startAisBus(Consumer<AisPacket> packetConsumer) {
    LOG.debug("Starting AisBus");
    try {
        DistributerConsumer distributor = new DistributerConsumer();
        distributor.getConsumers().add(packetConsumer);
        distributor.init();
        aisBus.registerConsumer(distributor);
        aisBus.start();
        aisBus.startConsumers();
        aisBus.startProviders();
    } catch (Exception e) {
        LOG.error("Failed to start AisBus", e);
        exit(-1);
    }
    LOG.debug("AisBus started");
}
 
开发者ID:dma-ais,项目名称:AisTrack,代码行数:17,代码来源:AisTrackService.java

示例2: AisView

import dk.dma.ais.bus.consumer.DistributerConsumer; //导入依赖的package包/类
private AisView(AisViewConfiguration conf) {
    this.conf = conf;

    // Create and start handler
    handler = new AisViewHandler(conf);
    handler.start();

    // Create AisBus
    aisBus = conf.getAisbusConfiguration().getInstance();

    // Create web server
    if (conf.getServerConfiguration() != null) {
        webServer = new WebServer(conf.getServerConfiguration());
    } else {
        webServer = null;
    }

    // Create distributor consumer and add to aisBus
    DistributerConsumer distributer = new DistributerConsumer();
    distributer.getConsumers().add(handler);
    distributer.init();
    aisBus.registerConsumer(distributer);

}
 
开发者ID:dma-ais,项目名称:AisAnalysis,代码行数:25,代码来源:AisView.java

示例3: AisCoverage

import dk.dma.ais.bus.consumer.DistributerConsumer; //导入依赖的package包/类
private AisCoverage(AisCoverageConfiguration conf) {
    this.conf = conf;

    // Create handler
    handler = new CoverageHandler(conf);

    // Create AisBus
    aisBus = conf.getAisbusConfiguration().getInstance();
    

    // Create web server
    if (conf.getServerConfiguration() != null) {
        webServer = new WebServer(conf.getServerConfiguration());
    } else {
        webServer = null;
    }

    final DistributerConsumer unfilteredConsumer = new DistributerConsumer(true);
    unfilteredConsumer.init();
    // Delegate unfiltered packets to handler
    unfilteredConsumer.getConsumers().add(new Consumer<AisPacket>() {
        @Override
        public void accept(AisPacket packet) {
            handler.receiveUnfiltered(packet);
        }
    });                
    aisBus.registerConsumer(unfilteredConsumer);
}
 
开发者ID:dma-ais,项目名称:AisCoverage,代码行数:29,代码来源:AisCoverage.java

示例4: makeConfiguration

import dk.dma.ais.bus.consumer.DistributerConsumer; //导入依赖的package包/类
@Test
public void makeConfiguration() throws FileNotFoundException, JAXBException {
    String filename = "src/main/resources/coverage-test.xml";
    AisCoverageConfiguration conf = new AisCoverageConfiguration();
    AisBusConfiguration aisBusConf = new AisBusConfiguration();

    // Provider
    TcpClientProviderConfiguration reader = new TcpClientProviderConfiguration();
    reader.getHostPort().add("ais163.sealan.dk:65262");
    aisBusConf.getProviders().add(reader);

    // Unfiltered consumer
    DistributerConsumerConfiguration unfilteredDist = new DistributerConsumerConfiguration();
    unfilteredDist.setName("UNFILTERED");
    aisBusConf.getConsumers().add(unfilteredDist);

    // Filtered consumer
    DistributerConsumerConfiguration filteredDist = new DistributerConsumerConfiguration();
    filteredDist.setName("FILTERED");
    DuplicateFilterConfiguration duplicateFilter = new DuplicateFilterConfiguration();
    filteredDist.getFilters().add(duplicateFilter);
    aisBusConf.getConsumers().add(filteredDist);
    conf.setAisbusConfiguration(aisBusConf);

    conf.setLatSize(1.5);
    conf.setLonSize(1.5);
    DatabaseConfiguration dbConf = new DatabaseConfiguration();
    conf.setDatabaseConfiguration(dbConf);
    // dbConf.set
    // dbConf.setName("MongoDB");
    // dbConf.setAddr("localhost");
    // dbConf.setPort(9999);
    // conf.setDatabase("MemoryOnly");

    AisCoverageConfiguration.save(filename, conf);

    conf = AisCoverageConfiguration.load(filename);
    AisBus aisBus = conf.getAisbusConfiguration().getInstance();
    DistributerConsumer filtered = (DistributerConsumer) aisBus.getConsumer("FILTERED");
    Assert.assertNotNull(filtered);
    DistributerConsumer unfiltered = (DistributerConsumer) aisBus.getConsumer("UNFILTERED");
    Assert.assertNotNull(unfiltered);
}
 
开发者ID:dma-ais,项目名称:AisCoverage,代码行数:44,代码来源:ConfigurationTest.java


注:本文中的dk.dma.ais.bus.consumer.DistributerConsumer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。