當前位置: 首頁>>代碼示例>>Java>>正文


Java Vertx.deployVerticle方法代碼示例

本文整理匯總了Java中io.vertx.core.Vertx.deployVerticle方法的典型用法代碼示例。如果您正苦於以下問題:Java Vertx.deployVerticle方法的具體用法?Java Vertx.deployVerticle怎麽用?Java Vertx.deployVerticle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.vertx.core.Vertx的用法示例。


在下文中一共展示了Vertx.deployVerticle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configureRestAssured

import io.vertx.core.Vertx; //導入方法依賴的package包/類
@BeforeClass
public static void configureRestAssured() {
	Vertx vertx = Vertx.vertx();

	JsonObject config = new JsonObject().put("server.port", getRandomPort());

	LoginHandler loginHandler = new LoginHandler();
	loginHandler.setInvocationHandler(new VertxInvocationHandler(vertx));

	RestVerticle restVerticle = new RestVerticle();
	restVerticle.setRequestHandlers(Arrays.asList(loginHandler));

	ServiceVerticle serviceVerticle = new ServiceVerticle();
	serviceVerticle.setServiceHandlers(Arrays.asList(loginHandler));

	DeploymentOptions options = new DeploymentOptions().setConfig(config);
	vertx.deployVerticle(restVerticle, options);
	vertx.deployVerticle(serviceVerticle, options);

	RestAssured.baseURI = "http://localhost";
	RestAssured.port = config.getInteger("server.port");
}
 
開發者ID:simonemasoni,項目名稱:vertx_spring,代碼行數:23,代碼來源:IntegrationTest.java

示例2: blockDeploy

import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static <VERTICLE extends AbstractVerticle> boolean blockDeploy(Vertx vertx,
    Class<VERTICLE> cls,
    DeploymentOptions options) throws InterruptedException {
  Holder<Boolean> result = new Holder<>();

  CountDownLatch latch = new CountDownLatch(1);
  vertx.deployVerticle(cls.getName(), options, ar -> {
    result.value = ar.succeeded();

    if (ar.failed()) {
      LOGGER.error("deploy vertx failed, cause ", ar.cause());
    }

    latch.countDown();
  });

  latch.await();

  return result.value;
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:21,代碼來源:VertxUtils.java

示例3: main

import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static void main(String... args) {

        final JsonObject config = Config.fromFile("config/demo6.json");

        Vertx vertx = Vertx.vertx();
        vertx.deployVerticle(new JSPercentilesDatasource(), new DeploymentOptions().setConfig(config));

         /*
        Vertx vertx = Vertx.vertx();
        vertx.deployVerticle(new JSAggregateDatasource(), new DeploymentOptions().setConfig(config));
        */

        VertxOptions opts = new VertxOptions().setClustered(true);
        Vertx.clusteredVertx(opts, result -> {
            if(result.succeeded()){
                LOG.info("Cluster running");
                Vertx cvertx = result.result();
                cvertx.deployVerticle(new JSPercentilesDatasource(), new DeploymentOptions().setConfig(config));
            } else {
                LOG.error("Clustering failed");
                throw new RuntimeException(result.cause());
            }
        });
    }
 
開發者ID:gmuecke,項目名稱:grafana-vertx-datasource,代碼行數:25,代碼來源:JSPercentilesDatasource.java

示例4: main

import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static void main(String [] args) throws IOException {
    Properties properties = loadProperties("config.properties");
    String messagingHost = properties.getProperty("service.hostname", "messaging.enmasse.svc");
    int messagingPort = Integer.parseInt(properties.getProperty("service.port", "5672"));
    String username = properties.getProperty("service.username", "test");
    String password = properties.getProperty("service.password", "test");

    String maxAddress = properties.getProperty("address.max", "max");
    String controlPrefix = properties.getProperty("address.control.prefix", "control");

    int minTemp = Integer.parseInt(properties.getProperty("control.temperature.min", "15"));
    int maxTemp = Integer.parseInt(properties.getProperty("control.temperature.max", "25"));

    Vertx vertx = Vertx.vertx();
    vertx.deployVerticle(new Thermostat(messagingHost, messagingPort, username, password, maxAddress, controlPrefix, minTemp, maxTemp));
}
 
開發者ID:EnMasseProject,項目名稱:enmasse-workshop,代碼行數:17,代碼來源:Thermostat.java

示例5: main

import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static void main(String[] args) {
	VertxOptions options = new VertxOptions(); 
	options.setMaxEventLoopExecuteTime(Long.MAX_VALUE);
	final Vertx vertx = Vertx.factory.vertx(options);
	ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfiguration.class);
	
	Verticle serverVerticle =  (Verticle) context.getBean("serverVerticle");
	Verticle userDatabaseVerticle =  (Verticle) context.getBean("userDatabaseVerticle");
	Verticle blogServiceVerticle = (Verticle) context.getBean("blogServiceVerticle");
	
	vertx.deployVerticle(serverVerticle);
	vertx.deployVerticle(userDatabaseVerticle, new DeploymentOptions().setWorker(true));
	vertx.deployVerticle(blogServiceVerticle, new DeploymentOptions().setWorker(true));
	
}
 
開發者ID:srihas,項目名稱:vertx-spring-mongo-blog,代碼行數:16,代碼來源:ApplicationStarter.java

示例6: start

import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static void start(Vertx vertx) {
    DfxConfig config = DfxConfig.load(MainVerticle.conf);
    vertx.deployVerticle(new PluginManagerVerticle(config), result -> {
        try {
            vertx.deployVerticle(new WatcherVerticle(config.getWatchCycle())
                    , new DeploymentOptions().setWorker(true));
        } catch (IOException e) {
            logger.error("An error happened during start process: {}", e);
            vertx.close();
            System.exit(-1);
        }
    });
}
 
開發者ID:DTeam-Top,項目名稱:dfx,代碼行數:14,代碼來源:PluginManagerVerticle.java

示例7: testServiceAccess

import io.vertx.core.Vertx; //導入方法依賴的package包/類
@Test
public void testServiceAccess() {
  Vertx vertx = Vertx.vertx();
  vertx.deployVerticle(PortfolioVerticle.class.getName());

  PortfolioService proxy = ProxyHelper.createProxy(PortfolioService.class, vertx, PortfolioService.ADDRESS);

  assertThat(proxy).isNotNull();
  AtomicReference<Portfolio> reference = new AtomicReference<>();
  proxy.getPortfolio(ar -> reference.set(ar.result()));

  await().untilAtomic(reference, not(nullValue()));

  vertx.close();
}
 
開發者ID:cescoffier,項目名稱:vertx-kubernetes-workshop,代碼行數:16,代碼來源:PortfolioVerticleTest.java

示例8: deployVerticles

import io.vertx.core.Vertx; //導入方法依賴的package包/類
private static void deployVerticles(final Vertx vertx) {

        final JsonObject mongoConfig = new JsonObject().put("host", "localhost")
                                                       .put("db_name", "rtm")
                                                       .put("col_name", "measurements");
        int parallelism = Runtime.getRuntime().availableProcessors() / 4;

        vertx.deployVerticle(SimpleTimeSeriesVerticle.class.getName(),
                             new DeploymentOptions().setInstances(parallelism)
                                                    .setConfig(new JsonObject().put(ADDRESS, "/queryChunks")
                                                                               .put(MONGO, mongoConfig)));
    }
 
開發者ID:gmuecke,項目名稱:grafana-vertx-datasource,代碼行數:13,代碼來源:WorkerNode.java

示例9: main

import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static void main(final String[] args) throws Exception {

        final VertxOptions vertOptions = new VertxOptions();
        vertOptions.setWarningExceptionTime(1);
        vertOptions.setWorkerPoolSize(50);

        final Vertx vertx = Vertx.vertx(vertOptions);
        final DeploymentOptions options = new DeploymentOptions();
        vertx.deployVerticle(new EngineSampleMain(), options);
    }
 
開發者ID:trajano,項目名稱:app-ms,代碼行數:11,代碼來源:EngineSampleMain.java

示例10: test

import io.vertx.core.Vertx; //導入方法依賴的package包/類
@Test
public void test() throws IOException {
    byte[] bytes = Files.readAllBytes(new File("src/test/resources/config/config.json").toPath());
    JsonObject config = new JsonObject(new String(bytes, "UTF-8"));

    Vertx vertx = Vertx.vertx();

    List<JsonObject> mch = new ArrayList<>();
    List<JsonObject> dvn = new ArrayList<>();
    List<JsonObject> bct = new ArrayList<>();

    vertx.eventBus().consumer(GeneratorConfigVerticle.ADDRESS, message -> {
        JsonObject quote = (JsonObject) message.body();
        System.out.println(quote.encodePrettily());
        assertThat(quote.getDouble("bid")).isGreaterThan(0);
        assertThat(quote.getDouble("ask")).isGreaterThan(0);
        assertThat(quote.getInteger("volume")).isGreaterThan(0);
        assertThat(quote.getInteger("shares")).isGreaterThan(0);
        switch (quote.getString("symbol")) {
            case "MCH":
                mch.add(quote);
                break;
            case "DVN":
                dvn.add(quote);
                break;
            case "BCT":
                bct.add(quote);
                break;
        }
    });

    vertx.deployVerticle(GeneratorConfigVerticle.class.getName(), new DeploymentOptions().setConfig(config));

    await().until(() -> mch.size() > 10);
    await().until(() -> dvn.size() > 10);
    await().until(() -> bct.size() > 10);
}
 
開發者ID:cescoffier,項目名稱:vertx-kubernetes-workshop,代碼行數:38,代碼來源:GeneratorConfigVerticleTest.java

示例11: main

import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static void main(String[] args) {
	Vertx vertx = Vertx.vertx();
	// deploying Chime
	vertx.deployVerticle("ceylon:herd.schedule.chime/0.2.0", res -> {
		  if (res.succeeded()) {
			  // Chime has been successfully deployed - start scheduling
			  scheduling(vertx);
		  } else {
			  System.out.println("Deployment failed! " + res.cause());
			  vertx.close();
		  }
	});
}
 
開發者ID:LisiLisenok,項目名稱:ChimeJavaExample,代碼行數:14,代碼來源:Main.java

示例12: deployVerticle

import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static <T extends AbstractVerticle> void deployVerticle(Vertx vertx, Class<T> cls, int instanceCount) {
  DeploymentOptions options = new DeploymentOptions().setInstances(instanceCount);

  vertx.deployVerticle(cls.getName(), options);
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:6,代碼來源:VertxUtils.java

示例13: main

import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static void main(String[] args) {
    Vertx vertx = Vertx.vertx();
    vertx.deployVerticle(Exercise6HttpVerticle.class.getName());
    // Keep using the once developed previously
    vertx.deployVerticle(Exercise5ProcessorVerticle.class.getName());
}
 
開發者ID:cescoffier,項目名稱:vertx-kubernetes-workshop,代碼行數:7,代碼來源:Exercise6.java

示例14: main

import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static void main(String... args) {

        final Vertx vertx = Vertx.vertx();
        final JsonObject config = Config.fromFile("config/demo4.json");
        vertx.deployVerticle(new AggregatingGrafanaDatasource(), new DeploymentOptions().setConfig(config));
    }
 
開發者ID:gmuecke,項目名稱:grafana-vertx-datasource,代碼行數:7,代碼來源:AggregatingGrafanaDatasource.java

示例15: main

import io.vertx.core.Vertx; //導入方法依賴的package包/類
public static void main(String[] args) {
    Vertx vertx = Vertx.vertx();
    vertx.deployVerticle(Exercise5HttpVerticle.class.getName());
    vertx.deployVerticle(Exercise5ProcessorVerticle.class.getName());
}
 
開發者ID:cescoffier,項目名稱:vertx-kubernetes-workshop,代碼行數:6,代碼來源:Exercise5.java


注:本文中的io.vertx.core.Vertx.deployVerticle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。