同步操作将从 githubsync/vertx-examples 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
This repository contains a range of examples so you can get up and running easily with Vert.x. 4
Vert.x 3 examples can be found here https://github.com/vert-x3/vertx-examples/tree/3.x
Start with the simplest Maven example to show you how to setup a simple Vert.x project that uses
Maven. You need to have Java 8 installed and set the JAVA_HOME
environment variable to point to your Java 8
installation.
Use that as a template for setting up a Maven project with Vert.x.
Progress to the simple Maven verticle example to show you how to deploy your code as verticles in a Maven project. Also check Maven verticles examples to show how you can use Maven with Groovy verticle.
Want to start right away, open the first example in Eclipse Che:
Start with the simplest Gradle example to show you how to setup a simple Vert.x project that uses Gradle.
Use that as a template for setting up a Gradle project with Vert.x.
Progress to the simple Gradle verticle example to show you how to deploy your code as verticles in a Gradle project
That’s fine too :)
You can run most of the examples at the command line using vertx run
if you have Vert.x installed (see below).
The examples demonstrate how to use all different bits of Vert.x including Vert.x core, Vert.x-Web and various other services and features.
Most of the examples have been written as verticles. For more information on verticles please consult the Vert.x core manual.
Using verticles allows you to scale and run your code from the command line more easily, but if you prefer the same code in the verticles can also be run embedded. It’s really up to you. Verticles are entirely optional in Vert.x.
Most of the Java examples can be run directly in your IDE (if you have one!).
We provide a main()
method in most of the example classes which allows you to conveniently run them directly in your IDE.
Just right click the main method or class in your IDE and run as… application (supported by all major IDEs).
If vertx
is installed you can also run any verticle directly on the command line. This way of working may be of interest
to you, if you don’t want to use Maven or Gradle or perhaps you don’t use an IDE.
Or perhaps you’re just a command line kind of person.
If you’re coming from using other platforms such as Node.js you might want to work this way. You can think of the
vertx
command as a bit like the node
command in Node.js.
Instructions for installing Vert.x are in the next section.
Once Vert.x is installed, to run an example, just cd to the example directory and type vertx run
followed by the filename
of the verticle. For example
cd core-examples/src/main/java/io/vertx/example/core vertx run EchoServer.java cd core-examples/src/main/js/echo vertx run echo_server.js
Yes! You can run Java source files directly using Vert.x (no compilation required).
Note
|
This is only necessary if you want to run Vert.x at the command line. If you’d prefer to work with Maven or Gradle projects then you don’t need to pre-install Vert.x - you just let Maven/Gradle pull in the Vert.x dependencies into your project as you would with any dependency. |
Pre-requisites: You will need to have Java 8 JDK installed.
Download a Vert.x 3 distribution
Unzip it somewhere on your disk (e.g. in your home directory)
Set your PATH
environment variable to include the installation directory
Test the install by typing vertx -version
.
On the download page, you will find several distributions. Each distribution has a different set of components:
Min: The min distribution contains only Vert.x Core, the support of the different languages, and the Hazelcast clustering.
Full: The full distribution contains all the components of the Vert.x stack. It includes Vert.x web and the different data access technologies.
The Vert.x core examples contains a wide range of examples using just Vert.x Core.
Vert.x-Web is a toolkit for building web applications using Vert.x
The Vert.x-Web examples contains a wide range of examples using Vert.x-Web
Vert.x Web Client that provides an easy to use web client for Vert.x.
The Vert.x Web Client examples contains a wide range of examples using the Vert.x Web Client
Vertx-Unit is a library for writing asynchronous tests. We include some examples of how to use this tool to test your Vert.x (or other asynchronous) applications.
The Vert.x Unit examples shows how to use Vert.x Unit.
The vertx-junit5
modules allow testing Vert.x asynchronous operations with JUnit 5.
Vert.x Opentracing examples contains a wide range of examples using Vert.x Opentracing.
Vert.x Zipkin examples contains a wide range of examples using Vert.x Zipkin.
Vert.x for RxJava provides most of its APIs as RxJava so you can use those if you prefer.
RxJava is a great choice when you want to perform complex operations on multiple asynchronous streams of data.
The Vert.x RxJava 2 examples contains a wide range of examples using Vert.x for RxJava 2 The Vert.x RxJava 3 examples contains a wide range of examples using Vert.x for RxJava 3
The Vert.x gRPC Examples show how you can implement a gRPC service and invoke a gRPC service with Vert.x.
The Vert.x Kotlin Examples shows a few examples with Kotlin such a REST application, Kotlin coroutines and usage of KotlinTest.
The Vert.x Mail examples contains a few examples using Vert.x Mail
The mail examples show different ways to create the mail message and send it via
tls, ssl etc. The examples either use localhost:25
to send a mail or use host
mail.example.com
. To actually run the examples you will have to change the
mail server and the user credentials in the MailLogin
example.
The Vert.x Service Proxy examples contains an example of service proxy usage. It depicts how a service provider can be implemented and how the published service can be consumed.
The Vert.x Docker examples shows how to deploy Vert.x application in Docker containers.
The Vert.x Spring Examples shows how vert.x application can be integrated inside a Spring ecosystem.
The Vert.x Redis Example shows how you can interact with Redis using the vert.x Redis client.
The Vert.x Mongo Example shows how you can interact with MongoDB using the vert.x Mongo client.
The Vert.x SQL Client Examples shows how you can interact PostgreSQL or MySQL Databases using the Reactive SQL client.
The Vert.x Kafka Examples shows how you can interact Kafka using the vert.x Kafka client.
The Vert.x MQTT Examples shows how you can write MQTT servers and clients using Vert.x MQTT.
The Vert.x Service Proxy examples contains an example of service proxy usage. It depicts how a service provider can be implemented and how the published service can be consumed.
This JPMS examples shows how a simple Java (11) modular application using Vert.x as automatic modules.
The Vert.x fatjar Examples show how you can build fatjar with Maven or Gradle.
This HTTP/2 Showcase application highlights the benefits of HTTP/2 when dealing with latency on the web.
The Vert.x Camel Bridge Examples show how you can use Apache Camel routes from the event bus.
The Vert.x Micrometer metrics examples show how to collect Vert.x metrics with Micrometer and send them to backends such as Prometheus or InfluxDB.
The Vert.x Web GraphQL examples contain simple client/server GraphQL applications built with Vert.x Web GraphQL and the GraphQL-Java library.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。