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


Java DefaultMessagePublisher类代码示例

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


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

示例1: doRun

import org.gbif.common.messaging.DefaultMessagePublisher; //导入依赖的package包/类
@Override
protected void doRun() {
  NubBuilder builder = NubBuilder.create(cfg);
  builder.run();
  builder.report(cfg.reportDir);

  if (cfg.autoImport) {
    try {
      MessagePublisher publisher = new DefaultMessagePublisher(cfg.messaging.getConnectionParameters());
      publisher.send(new ChecklistNormalizedMessage(Constants.NUB_DATASET_KEY));
      LOG.info("Sending ChecklistNormalizedMessage for backbone dataset {}", Constants.NUB_DATASET_KEY);
      publisher.close();
    } catch (IOException e) {
      Throwables.propagate(e);
    }
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:18,代码来源:NubBuildCommand.java

示例2: startUp

import org.gbif.common.messaging.DefaultMessagePublisher; //导入依赖的package包/类
@Override
protected void startUp() throws Exception {
  // Create Registry WS Client
  Properties properties = new Properties();
  properties.setProperty("registry.ws.url", configuration.registryWsUrl);

  Injector injector = Guice.createInjector(new RegistryWsClientModule(properties), new AnonymousAuthModule());
  OrganizationService orgClient = injector.getInstance(OrganizationService.class);

  // we have to create our own object mapper in order to set FAIL_ON_UNKNOWN, without which we can't deser reg objects
  ObjectMapper objectMapper = new ObjectMapper();
  objectMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  listener = new MessageListener(configuration.messaging.getConnectionParameters(), new DefaultMessageRegistry(),
    objectMapper);
  listener.listen(configuration.registryChangeQueueName, 1,
    new RegistryChangeListener(new DefaultMessagePublisher(configuration.messaging.getConnectionParameters()),
      orgClient));
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:19,代码来源:RegistryChangeService.java

示例3: FragmentProcessorThroughputTest

import org.gbif.common.messaging.DefaultMessagePublisher; //导入依赖的package包/类
public FragmentProcessorThroughputTest(int hbasePoolSize) throws IOException {
  Configuration hBaseConfiguration = HBaseConfiguration.create();
  hBaseConfiguration.set("hbase.hconnection.threads.max", Integer.toString(hbasePoolSize));
  Connection connection = org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(hBaseConfiguration);
  HBaseLockingKeyService keyService =
    new HBaseLockingKeyService(CFG, connection);
  OccurrenceKeyPersistenceService occurrenceKeyService = new OccurrenceKeyPersistenceServiceImpl(keyService);
  FragmentPersistenceService fragService =
    new FragmentPersistenceServiceImpl(CFG, connection, occurrenceKeyService);
  ConnectionFactory connectionFactory = new ConnectionFactory();
  connectionFactory.setHost("mq.gbif.org");
  connectionFactory.setVirtualHost("/users/omeyn");
  connectionFactory.setUsername("omeyn");
  connectionFactory.setPassword("omeyn");
  MessagePublisher messagePublisher =
    new DefaultMessagePublisher(new ConnectionParameters("mq.gbif.org", 5672, "omeyn", "omeyn", "/users/omeyn"));
  CuratorFramework curator =
    CuratorFrameworkFactory.builder().namespace("/fragproctest").retryPolicy(new ExponentialBackoffRetry(25, 100))
      .connectString("zk1.gbif-dev.org:2181").build();
  curator.start();
  ZookeeperConnector zkConnector = new ZookeeperConnector(curator);
  fragmentProcessor = new FragmentProcessor(fragService, occurrenceKeyService, messagePublisher, zkConnector);
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:24,代码来源:FragmentProcessorThroughputTest.java

示例4: setUp

import org.gbif.common.messaging.DefaultMessagePublisher; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  ConnectionParameters connectionParameters = new ConnectionParameters("localhost", 5672, "guest", "guest", "/");
  messagePublisher = new DefaultMessagePublisher(connectionParameters);

  zkServer = new TestingServer();
  curator = CuratorFrameworkFactory.builder().connectString(zkServer.getConnectString()).namespace("crawler")
    .retryPolicy(new RetryNTimes(1, 1000)).build();
  curator.start();
  zookeeperConnector = new ZookeeperConnector(curator);

  occurrenceKeyService = new OccurrenceKeyPersistenceServiceMock();
  fragmentPersistenceService = new FragmentPersistenceServiceMock(occurrenceKeyService);
  fragmentProcessor =
    new FragmentProcessor(fragmentPersistenceService, occurrenceKeyService, messagePublisher, zookeeperConnector);
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:17,代码来源:FragmentProcessorTest.java

示例5: startUp

import org.gbif.common.messaging.DefaultMessagePublisher; //导入依赖的package包/类
@Override
protected void startUp() throws Exception {
  publisher = new DefaultMessagePublisher(cfg.messaging.getConnectionParameters());

  listener = new MessageListener(cfg.messaging.getConnectionParameters(), 1);
  listener.listen(QUEUE, 1, this);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:8,代码来源:NubChangedService.java

示例6: startUp

import org.gbif.common.messaging.DefaultMessagePublisher; //导入依赖的package包/类
@Override
protected void startUp() throws Exception {
  publisher = new DefaultMessagePublisher(mCfg.getConnectionParameters());

  // dataset messages are slow, long running processes. Only prefetch one message
  listener = new MessageListener(mCfg.getConnectionParameters(), 1);
  startUpBeforeListening();
  listener.listen(queue, poolSize, this);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:10,代码来源:RabbitBaseService.java

示例7: startUp

import org.gbif.common.messaging.DefaultMessagePublisher; //导入依赖的package包/类
@Override
protected void startUp() throws Exception {
  Injector inj = Guice.createInjector(new OccurrencePersistenceModule(config.hbase));

  config.ganglia.start();

  OccurrenceDeletionService occurrenceDeletionService = new OccurrenceDeletionService(
    inj.getInstance(OccurrencePersistenceService.class), inj.getInstance(OccurrenceKeyPersistenceService.class));

  listener = new MessageListener(config.messaging.getConnectionParameters());
  listener.listen(config.queueName, config.msgPoolSize,
    new DeleteOccurrenceListener(occurrenceDeletionService,
    new DefaultMessagePublisher(config.messaging.getConnectionParameters())));
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:15,代码来源:DeleterService.java

示例8: setUp

import org.gbif.common.messaging.DefaultMessagePublisher; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  ApiClientConfiguration cfg = new ApiClientConfiguration();;
  cfg.url = URI.create("http://api.gbif-dev.org/v1/");

  ConnectionParameters connectionParams = new ConnectionParameters("localhost", 5672, "guest", "guest", "/");
  messagePublisher = new DefaultMessagePublisher(connectionParams);
  messageListener = new MessageListener(connectionParams);

  zkServer = new TestingServer();
  curator = CuratorFrameworkFactory.builder().connectString(zkServer.getConnectString()).namespace("crawlertest")
    .retryPolicy(new RetryNTimes(1, 1000)).build();
  curator.start();
  zookeeperConnector = new ZookeeperConnector(curator);

  long now = System.currentTimeMillis();
  fragmentProcessor =
    new FragmentProcessor(fragmentPersister, occurrenceKeyService, messagePublisher, zookeeperConnector);
  occurrenceFragmentedListener = new OccurrenceFragmentedListener(fragmentProcessor);
  messageListener.listen("occ_frag_test_" + now, 1, occurrenceFragmentedListener);
  verbatimProcessor =
    new VerbatimProcessor(fragmentPersister, occurrenceService, messagePublisher, zookeeperConnector);
  fragmentPersistedListener = new FragmentPersistedListener(verbatimProcessor);
  messageListener.listen("frag_persisted_test_" + now, 1, fragmentPersistedListener);
  interpretedProcessor = new InterpretedProcessor(
    new OccurrenceInterpreter(new DatasetInfoInterpreter(cfg.newApiClient()),
    new TaxonomyInterpreter(cfg.newApiClient()),
    new LocationInterpreter(new CoordinateInterpreter(cfg.newApiClient()))),
      fragmentPersister, occurrenceService, messagePublisher, zookeeperConnector
  );
  verbatimPersistedListener = new VerbatimPersistedListener(interpretedProcessor);
  messageListener.listen("verb_persisted_test_" + now, 1, verbatimPersistedListener);
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:34,代码来源:OccurrenceProcessorIT.java

示例9: provideMessagePublisher

import org.gbif.common.messaging.DefaultMessagePublisher; //导入依赖的package包/类
@Provides
@Singleton
public MessagePublisher provideMessagePublisher() throws Exception {
  return new DefaultMessagePublisher(cfg.messaging.getConnectionParameters());
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:6,代码来源:OccurrenceProcessorModule.java

示例10: preClass

import org.gbif.common.messaging.DefaultMessagePublisher; //导入依赖的package包/类
@BeforeClass
public static void preClass() throws IOException {
  messagePublisher = new DefaultMessagePublisher(CONNECTION_PARAMETERS);
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:5,代码来源:VerbatimProcessorTest.java


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