當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。