Java Code Examples for io.vertx.reactivex.core.Vertx#vertx()
The following examples show how to use
io.vertx.reactivex.core.Vertx#vertx() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserWebAppVerticle.java From vertx-in-action with MIT License | 5 votes |
public static void main(String[] args) { System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.SLF4JLogDelegateFactory"); Vertx vertx = Vertx.vertx(); vertx .rxDeployVerticle(new UserWebAppVerticle()) .subscribe( ok -> logger.info("HTTP server started on port {}", HTTP_PORT), err -> logger.error("Woops", err)); }
Example 2
Source File: InMemoryUserStoreTest.java From graviteeio-access-management with Apache License 2.0 | 5 votes |
@Test public void shouldNotGetUser_userEviction() throws InterruptedException { User user = new User(); user.setId("user-id"); user.setUsername("username"); Vertx vertx = Vertx.vertx(); InMemoryUserStore inMemoryUserStore = new InMemoryUserStore(vertx, 1000); inMemoryUserStore.add(user); Thread.sleep(3000l); User fetchedUser = inMemoryUserStore.get(user.getId()); Assert.assertNull(fetchedUser); vertx.close(); }
Example 3
Source File: RxVertxTestBase.java From graviteeio-access-management with Apache License 2.0 | 5 votes |
public void setUp() throws Exception { super.setUp(); vinit(); VertxOptions options = getOptions(); boolean nativeTransport = options.getPreferNativeTransport(); vertx = Vertx.vertx(options); if (nativeTransport) { assertTrue(vertx.isNativeTransportEnabled()); } }
Example 4
Source File: AbstractSuperAPI.java From rxjava2-lab with Apache License 2.0 | 5 votes |
protected Flowable<Character> load() { Vertx vertx = Vertx.vertx(); FileSystem fileSystem = vertx.fileSystem(); return fileSystem.rxReadFile("src/main/resources/characters.json") .map(buffer -> buffer.toString()) .map(content -> new JsonArray(content)) .flatMapPublisher(array -> Flowable.fromIterable(array)) .cast(JsonObject.class) .map(json -> json.mapTo(Character.class)); }
Example 5
Source File: Code2.java From rxjava2-lab with Apache License 2.0 | 5 votes |
static Single<JsonArray> load() { Vertx vertx = Vertx.vertx(); FileSystem fileSystem = vertx.fileSystem(); return fileSystem.rxReadFile("src/main/resources/characters.json") .map(buffer -> buffer.toString()) .map(content -> new JsonArray(content)); }
Example 6
Source File: SuperHeroesService.java From rxjava2-lab with Apache License 2.0 | 5 votes |
public Completable start() { Vertx vertx = Vertx.vertx(); Router router = Router.router(vertx); router.get("/heroes").handler(this::getAllHeroes); router.get("/villains").handler(this::getAllVillains); router.get("/heroes/random").handler(this::getRandomHero); router.get("/heroes/:id").handler(this::getHeroById); router.get("/villains/random").handler(this::getRandomVillain); router.get("/villains/:id").handler(this::getVillainById); return vertx.fileSystem().rxReadFile("src/main/resources/characters.json") .map(buffer -> buffer.toJsonArray().stream().map(o -> new Character((JsonObject) o)).collect(Collectors.toList())) .doOnSuccess(list -> { if (verbose) { System.out.println("Loaded " + list.size() + " heroes and villains"); } }) .doOnSuccess(list -> { this.villains = list.stream().filter(Character::isVillain).collect( HashMap::new, (map, superStuff) -> map.put(superStuff.getId(), superStuff), HashMap::putAll); this.heroes = list.stream().filter(e -> ! e.isVillain()).collect( HashMap::new, (map, superStuff) -> map.put(superStuff.getId(), superStuff), HashMap::putAll); }) .flatMap(x -> vertx.createHttpServer() .requestHandler(router::accept) .rxListen(8080)) .toCompletable(); }
Example 7
Source File: EventStatsVerticle.java From vertx-in-action with MIT License | 5 votes |
public static void main(String[] args) { System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.SLF4JLogDelegateFactory"); Vertx vertx = Vertx.vertx(); vertx.rxDeployVerticle(new EventStatsVerticle()) .subscribe( ok -> logger.info("Started"), err -> logger.error("Woops", err)); }
Example 8
Source File: IngesterVerticle.java From vertx-in-action with MIT License | 5 votes |
public static void main(String[] args) { System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.SLF4JLogDelegateFactory"); Vertx vertx = Vertx.vertx(); vertx.rxDeployVerticle(new IngesterVerticle()) .subscribe( ok -> logger.info("HTTP server started on port {}", HTTP_PORT), err -> logger.error("Woops", err)); }
Example 9
Source File: OAuth2GenericAuthenticationProviderTestConfiguration.java From graviteeio-access-management with Apache License 2.0 | 4 votes |
@Bean public Vertx vertx() { return Vertx.vertx(); }
Example 10
Source File: CongratsVerticle.java From vertx-in-action with MIT License | 4 votes |
public static void main(String[] args) { Vertx vertx = Vertx.vertx(); vertx.rxDeployVerticle(new CongratsVerticle()) .subscribe(ok -> logger.info("Ready to notify people reaching more than 10k steps")); }
Example 11
Source File: Code1.java From rxjava2-lab with Apache License 2.0 | 4 votes |
static Single<String> getFile() { Vertx vertx = Vertx.vertx(); FileSystem fileSystem = vertx.fileSystem(); return fileSystem.rxReadFile("src/main/resources/characters.json") .map(buffer -> buffer.toString()); }
Example 12
Source File: SomethingDaoTest.java From vertx-jooq with MIT License | 4 votes |
public SomethingDaoTest() { super(Tables.SOMETHING.SOMEHUGENUMBER, new SomethingDao(HsqldbConfigurationProvider.getInstance().createDAOConfiguration(), Vertx.vertx())); }
Example 13
Source File: SomethingCompositeDaoTest.java From vertx-jooq with MIT License | 4 votes |
public SomethingCompositeDaoTest() { super(Tables.SOMETHINGCOMPOSITE.SOMEJSONOBJECT, new SomethingcompositeDao(HsqldbConfigurationProvider.getInstance().createDAOConfiguration(), Vertx.vertx())); }
Example 14
Source File: HttpUserProviderTestConfiguration.java From graviteeio-access-management with Apache License 2.0 | 4 votes |
@Bean public Vertx vertx() { return Vertx.vertx(); }
Example 15
Source File: StageTestBase.java From smallrye-reactive-streams-operators with Apache License 2.0 | 4 votes |
@Before public void setUp() { vertx = Vertx.vertx(); }
Example 16
Source File: VertxFactory.java From ocraft-s2client with MIT License | 4 votes |
static Vertx create() { System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.SLF4JLogDelegateFactory"); System.setProperty("vertx.disableFileCaching", "true"); return Vertx.vertx(); }
Example 17
Source File: VertxFactory.java From ocraft-s2client with MIT License | 4 votes |
static Vertx create() { System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.SLF4JLogDelegateFactory"); System.setProperty("vertx.disableFileCaching", "true"); return Vertx.vertx(); }
Example 18
Source File: VertxParameterProvider.java From vertx-rx with Apache License 2.0 | 4 votes |
@Override public Vertx newInstance(ExtensionContext extensionContext, ParameterContext parameterContext) { return Vertx.vertx(); }
Example 19
Source File: SomethingDaoTest.java From vertx-jooq with MIT License | 4 votes |
public SomethingDaoTest() { super(Tables.SOMETHING.SOMEHUGENUMBER, new SomethingDao(HsqldbConfigurationProvider.getInstance().createDAOConfiguration(), Vertx.vertx())); }
Example 20
Source File: GithubAuthenticationProviderTestConfiguration.java From graviteeio-access-management with Apache License 2.0 | 4 votes |
@Bean public Vertx vertx() { return Vertx.vertx(); }