List of usage examples for io.vertx.core.json JsonObject JsonObject
public JsonObject()
From source file:examples.RedisDataSourceExamples.java
License:Open Source License
public void example2(ServiceDiscovery discovery) { // Get the record discovery.getRecord(new JsonObject().put("name", "some-redis-data-source-service"), ar -> { if (ar.succeeded() && ar.result() != null) { // Retrieve the service reference ServiceReference reference = discovery.getReference(ar.result()); // Retrieve the service instance RedisClient client = reference.get(); // ... // when done reference.release();//from ww w . j a v a 2 s .co m } }); }
From source file:examples.RedisDataSourceExamples.java
License:Open Source License
public void example3(ServiceDiscovery discovery) { RedisDataSource.getRedisClient(discovery, new JsonObject().put("name", "some-redis-data-source-service"), ar -> {/* w ww .java2 s . c o m*/ if (ar.succeeded()) { RedisClient client = ar.result(); // ... // Dont' forget to release the service ServiceDiscovery.releaseServiceObject(discovery, client); } }); }
From source file:examples.RxMongoClientExamples.java
License:Apache License
public void findBatch(MongoClient mongoClient) { // Will match all Tolkien books JsonObject query = new JsonObject().put("author", "J. R. R. Tolkien"); ReadStream<JsonObject> books = mongoClient.findBatch("book", query); // Convert the stream to a Flowable Flowable<JsonObject> flowable = books.toFlowable(); flowable.subscribe(doc -> {//from w w w. jav a 2 s . c o m System.out.println("Found doc: " + doc.encodePrettily()); }, throwable -> { throwable.printStackTrace(); }, () -> { System.out.println("End of research"); }); }
From source file:examples.ShellExamples.java
License:Open Source License
public void deployTelnetService(Vertx vertx) throws Exception { vertx.deployVerticle("maven:{maven-groupId}:{maven-artifactId}:{maven-version}", new DeploymentOptions().setConfig(new JsonObject().put("telnetOptions", new JsonObject().put("host", "localhost").put("port", 4000)))); }
From source file:examples.ShellExamples.java
License:Open Source License
public void deploySSHServiceWithShiro(Vertx vertx) throws Exception { vertx.deployVerticle("maven:{maven-groupId}:{maven-artifactId}:{maven-version}", new DeploymentOptions() .setConfig(new JsonObject().put("sshOptions", new JsonObject() .put("host", "localhost").put("port", 5000).put( "keyPairOptions", new JsonObject().put("path", "src/test/resources/ssh.jks") .put("password", "wibble")) .put("authOptions", new JsonObject().put("provider", "shiro").put("config", new JsonObject().put("properties_path", "file:/path/to/my/auth.properties")))))); }
From source file:examples.ShellExamples.java
License:Open Source License
public void deploySSHServiceWithJDBC(Vertx vertx) throws Exception { vertx.deployVerticle("maven:{maven-groupId}:{maven-artifactId}:{maven-version}", new DeploymentOptions().setConfig(new JsonObject().put("sshOptions", new JsonObject().put("host", "localhost").put("port", 5000) .put("keyPairOptions", new JsonObject().put("path", "src/test/resources/ssh.jks").put("password", "wibble")) .put("authOptions", new JsonObject().put("provider", "jdbc").put("config", new JsonObject().put("url", "jdbc:hsqldb:mem:test?shutdown=true") .put("driver_class", "org.hsqldb.jdbcDriver")))))); }
From source file:examples.ShellExamples.java
License:Open Source License
public void deploySSHServiceWithMongo(Vertx vertx) throws Exception { vertx.deployVerticle("maven:{maven-groupId}:{maven-artifactId}:{maven-version}", new DeploymentOptions() .setConfig(new JsonObject().put("sshOptions", new JsonObject() .put("host", "localhost").put("port", 5000).put( "keyPairOptions", new JsonObject().put("path", "src/test/resources/ssh.jks") .put("password", "wibble")) .put("authOptions", new JsonObject().put("provider", "mongo").put("config", new JsonObject().put("connection_string", "mongodb://localhost:27018")))))); }
From source file:examples.ShellExamples.java
License:Open Source License
public void deployHttpServiceWithShiro(Vertx vertx) throws Exception { vertx.deployVerticle("maven:{maven-groupId}:{maven-artifactId}:{maven-version}", new DeploymentOptions().setConfig(new JsonObject().put("httpOptions", new JsonObject() .put("host", "localhost").put("port", 8080).put("ssl", true) .put("keyPairOptions", new JsonObject().put("path", "src/test/resources/server-keystore.jks") .put("password", "wibble")) .put("authOptions", new JsonObject().put("provider", "shiro").put("config", new JsonObject() .put("properties_path", "file:/path/to/my/auth.properties")))))); }
From source file:examples.ShellExamples.java
License:Open Source License
public void deployHttpServiceWithJDBC(Vertx vertx) throws Exception { vertx.deployVerticle("maven:{maven-groupId}:{maven-artifactId}:{maven-version}", new DeploymentOptions().setConfig(new JsonObject().put("httpOptions", new JsonObject().put("host", "localhost").put("port", 8080).put("ssl", true) .put("keyPairOptions", new JsonObject().put("path", "src/test/resources/server-keystore.jks") .put("password", "wibble")) .put("authOptions", new JsonObject().put("provider", "jdbc").put("config", new JsonObject().put("url", "jdbc:hsqldb:mem:test?shutdown=true") .put("driver_class", "org.hsqldb.jdbcDriver")))))); }
From source file:examples.ShellExamples.java
License:Open Source License
public void deployHttpServiceWithMongo(Vertx vertx) throws Exception { vertx.deployVerticle("maven:{maven-groupId}:{maven-artifactId}:{maven-version}", new DeploymentOptions().setConfig(new JsonObject().put("httpOptions", new JsonObject().put("host", "localhost").put("port", 8080).put("ssl", true) .put("keyPairOptions", new JsonObject().put("path", "src/test/resources/server-keystore.jks") .put("password", "wibble")) .put("authOptions", new JsonObject().put("provider", "mongo").put("config", new JsonObject().put("connection_string", "mongodb://localhost:27018")))))); }