Skip to content

Commit

Permalink
Merge pull request #450 from tsegismont/cli_cleanup
Browse files Browse the repository at this point in the history
Cli cleanup
  • Loading branch information
tsegismont authored Jul 6, 2023
2 parents e43a2ab + dfe86a4 commit 4e72528
Show file tree
Hide file tree
Showing 433 changed files with 5,331 additions and 7,313 deletions.
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ src/main/groovy/io/vertx/groovy/core/**/*.groovy
src/test/groovy/io/vertx/groovy/codegen/**/*.groovy
openshift-example/quickstart-diy/application/*.jar
openshift-example/vertx-cartridge/application/*.jar
web-examples/src/main/java/io/vertx/example/web/vertxbus/amd/webroot/sockjs-client
/web-examples/src/main/java/io/vertx/example/web/react/webroot/dist
web-examples/src/main/java/io/vertx/example/web/vertxbus/amd/webroot/vertx3-eventbus-client
web-examples/src/main/java/io/vertx/example/web/vertxbus/commonjs/webroot/node_modules
web-examples/src/main/java/io/vertx/example/web/vertxbus/node/node_modules
web-examples/src/main/java/io/vertx/example/web/vertxbus/webpack/client/node_modules
web-examples/src/main/java/io/vertx/example/web/react/webroot/dist
web-examples/src/main/java/io/vertx/example/web/react/node_modules
service-proxy-examples/service-provider/node-client/node_modules
openshift2-example/**/*.jar
Expand Down
64 changes: 9 additions & 55 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,74 +1,28 @@
= Vert.x 4 examples

This repository contains a range of examples so you can get up and running easily with Vert.x. 4
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

== The examples

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.
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.
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.

=== Running the examples

==== Running in your IDE

Most of the Java examples can be run directly in your IDE (if you have one!).
Most of the Java examples can be run directly in your IDE.

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).

==== Running at the command line

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).

==== Installing Vert.x

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.

1. Download a link:https://bintray.com/vertx/downloads/distribution/view[Vert.x 3 distribution]
2. Unzip it somewhere on your disk (e.g. in your home directory)
3. Set your `PATH` environment variable to include the installation directory
4. 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.
Just right-click the main method or class in your IDE and run as... application (supported by all major IDEs).

=== Vert.x core examples

Expand All @@ -82,7 +36,7 @@ The link:web-examples/README.adoc[Vert.x-Web examples] contains a wide range of

=== Vert.x Web Client examples

Vert.x Web Client that provides an easy to use web client for Vert.x.
Vert.x Web Client that provides an easy-to-use web client for Vert.x.

The link:web-client-examples/README.adoc[Vert.x Web Client examples] contains a wide range of examples using the Vert.x Web Client

Expand All @@ -109,7 +63,7 @@ link:zipkin-examples/README.adoc[Vert.x Zipkin examples] contains a wide range o

=== RxJava examples

Vert.x for RxJava provides most of its APIs as RxJava so you can use those if you prefer.
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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,18 @@
*/
package io.vertx.example.proton.client;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Launcher;
import io.vertx.proton.ProtonClient;
import io.vertx.proton.ProtonConnection;

import org.apache.qpid.proton.amqp.messaging.AmqpValue;

import io.vertx.core.AbstractVerticle;
import io.vertx.example.util.Runner;

public class Receiver extends AbstractVerticle {

private String address = "examples";

// Convenience method so you can run it in your IDE
public static void main(String[] args) {
Runner.runExample(Receiver.class);
Launcher.executeCommand("run", Receiver.class.getName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,24 @@
package io.vertx.example.proton.client;


import java.time.Instant;

import org.apache.qpid.proton.amqp.messaging.AmqpValue;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Launcher;
import io.vertx.core.Vertx;
import io.vertx.example.util.Runner;
import io.vertx.proton.ProtonClient;
import io.vertx.proton.ProtonConnection;
import io.vertx.proton.ProtonReceiver;
import org.apache.qpid.proton.amqp.messaging.AmqpValue;

import java.time.Instant;

public class ReconnectReceiver extends AbstractVerticle {

private static final String ADDRESS = "examples";

private ConnectionControl connectionControl = new ConnectionControl("localhost:5672", "localhost:15672");

// Convenience method so you can run it in your IDE
public static void main(String[] args) {
Runner.runExample(ReconnectReceiver.class);
Launcher.executeCommand("run", ReconnectReceiver.class.getName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@
*/
package io.vertx.example.proton.client;

import static io.vertx.proton.ProtonHelper.message;

import java.time.Instant;

import org.apache.qpid.proton.message.Message;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Launcher;
import io.vertx.core.Vertx;
import io.vertx.example.util.Runner;
import io.vertx.proton.ProtonClient;
import io.vertx.proton.ProtonConnection;
import io.vertx.proton.ProtonSender;
import org.apache.qpid.proton.message.Message;

import java.time.Instant;

import static io.vertx.proton.ProtonHelper.message;

public class ReconnectSender extends AbstractVerticle {

Expand All @@ -39,9 +38,8 @@ public class ReconnectSender extends AbstractVerticle {
private int confirmed;
private ProtonConnection conn;

// Convenience method so you can run it in your IDE
public static void main(String[] args) {
Runner.runExample(ReconnectSender.class);
Launcher.executeCommand("run", ReconnectSender.class.getName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,24 @@
*/
package io.vertx.example.proton.client;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Launcher;
import io.vertx.proton.ProtonClient;
import io.vertx.proton.ProtonConnection;
import io.vertx.proton.ProtonSender;

import static io.vertx.proton.ProtonHelper.message;
import org.apache.qpid.proton.message.Message;

import java.util.concurrent.atomic.AtomicInteger;

import org.apache.qpid.proton.message.Message;

import io.vertx.core.AbstractVerticle;
import io.vertx.example.util.Runner;
import static io.vertx.proton.ProtonHelper.message;

public class Sender extends AbstractVerticle {

private String address = "examples";
private AtomicInteger sent = new AtomicInteger();

// Convenience method so you can run it in your IDE
public static void main(String[] args) {
Runner.runExample(Sender.class);
Launcher.executeCommand("run", Sender.class.getName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,23 @@
*/
package io.vertx.example.proton.server;

import static io.vertx.proton.ProtonHelper.message;

import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;

import org.apache.qpid.proton.amqp.messaging.AmqpValue;
import org.apache.qpid.proton.amqp.messaging.Section;
import org.apache.qpid.proton.amqp.transport.AmqpError;
import org.apache.qpid.proton.amqp.transport.ErrorCondition;
import org.apache.qpid.proton.message.Message;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Launcher;
import io.vertx.core.Vertx;
import io.vertx.example.util.Runner;
import io.vertx.proton.ProtonConnection;
import io.vertx.proton.ProtonReceiver;
import io.vertx.proton.ProtonSender;
import io.vertx.proton.ProtonServer;
import org.apache.qpid.proton.amqp.messaging.AmqpValue;
import org.apache.qpid.proton.amqp.messaging.Section;
import org.apache.qpid.proton.amqp.transport.AmqpError;
import org.apache.qpid.proton.amqp.transport.ErrorCondition;
import org.apache.qpid.proton.message.Message;

import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;

import static io.vertx.proton.ProtonHelper.message;

/**
* HelloServer
Expand All @@ -45,9 +44,8 @@ public class HelloServer extends AbstractVerticle {

private static final int PORT = 5672;

// Convenience method so you can run it in your IDE
public static void main(String[] args) {
Runner.runExample(HelloServer.class);
Launcher.executeCommand("run", HelloServer.class.getName());
}

@Override
Expand Down

This file was deleted.

17 changes: 0 additions & 17 deletions circuit-breaker-examples/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,3 @@ To run this example you need to:

1. start or not the server (if not started, the circuit breaker will invoke the fallback)
2. start the client


To start the server, run the `Server.java` class from your IDE or call:

----
vertx run src/main/java/io/vertx/example/circuit/breaker/Server.java
----

To start the client, run the `Client.java` class from your IDE or call:

----
# java version
vertx run src/main/java/io/vertx/example/circuit/breaker/Client.java
----



Loading

0 comments on commit 4e72528

Please sign in to comment.