GithubHelp home page GithubHelp logo

vert-x3 / vertx-examples Goto Github PK

View Code? Open in Web Editor NEW
3.5K 238.0 2.1K 50.08 MB

Vert.x examples

License: Apache License 2.0

HTML 5.92% JavaScript 2.93% Java 81.45% Kotlin 0.66% FreeMarker 0.01% TypeScript 0.26% Handlebars 0.66% Less 8.11%
vertx reactive async examples http2 kotlin

vertx-examples's Introduction

Vert.x 4 examples

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.

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.

Running the examples

Running in your IDE

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

Vert.x core examples

The Vert.x core examples contains a wide range of examples using just Vert.x Core.

Vert.x-Web examples

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 examples

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 examples

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.

Virtual Threads

The virtual-threads-examples module shows how to use Vert.x with virtual threads.

Vert.x JUnit 5 examples

The vertx-junit5 modules allow testing Vert.x asynchronous operations with JUnit 5.

Vert.x Opentracing examples

Vert.x Opentracing examples contains a wide range of examples using Vert.x Opentracing.

Vert.x Zipkin examples

Vert.x Zipkin examples contains a wide range of examples using Vert.x Zipkin.

RxJava examples

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

gRPC examples

The Vert.x gRPC Examples show how you can implement a gRPC service and invoke a gRPC service with Vert.x.

Kotlin examples

The Vert.x Kotlin Examples shows a few examples with Kotlin such a REST application, Kotlin coroutines and usage of KotlinTest.

Mail examples

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.

Service Proxy Examples

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.

Spring Examples

The Vert.x Spring Examples shows how vert.x application can be integrated inside a Spring ecosystem.

Redis example

The Vert.x Redis Example shows how you can interact with Redis using the vert.x Redis client.

Mongo example

The Vert.x Mongo Example shows how you can interact with MongoDB using the vert.x Mongo client.

SQL client example

The Vert.x SQL Client Examples shows how you can interact PostgreSQL or MySQL Databases using the Reactive SQL client.

Kafka example

The Vert.x Kafka Examples shows how you can interact Kafka using the vert.x Kafka client.

MQTT example

The Vert.x MQTT Examples shows how you can write MQTT servers and clients using Vert.x MQTT.

Service Proxy Examples

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.

JPMS examples

This JPMS examples shows how a simple Java (11) modular application using Vert.x as automatic modules.

HTTP/2 Showcase

This HTTP/2 Showcase application highlights the benefits of HTTP/2 when dealing with latency on the web.

Camel Bridge examples

The Vert.x Camel Bridge Examples show how you can use Apache Camel routes from the event bus.

Micrometer metrics examples

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.

GraphQL examples

The Vert.x Web GraphQL examples contain simple client/server GraphQL applications built with Vert.x Web GraphQL and the GraphQL-Java library.

vertx-examples's People

Contributors

alexlehm avatar amdelamar avatar billyyccc avatar cescoffier avatar culmat avatar emadalblueshi avatar gemmellr avatar gmariotti avatar gouline avatar jkutner avatar jotak avatar jponge avatar junbong avatar mis94 avatar napperley avatar okou19900722 avatar pahan-madusha avatar pmlopes avatar ppatierno avatar purplefox avatar rogelio-o avatar ruchirakulathunga avatar sammers21 avatar sanjuthomas avatar slinkydeveloper avatar tomaszmichalak avatar tsegismont avatar vietj avatar vtrbtf avatar zepouet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vertx-examples's Issues

cannot find examples-utils

I am not able to find

io.vertx
examples-utils
${project.version}
true

for version 3.2.0
Am I missing something?

web-examples auth java example error

I tried the following example https://github.com/vert-x3/vertx-examples/blob/master/web-examples/src/main/java/io/vertx/example/web/auth/Server.java

and I have the following error.

Using session cookies without https could make you susceptible to session hijacking: http://0.0.0.0:8080/login
Using session cookies without https could make you susceptible to session

hijacking: http://0.0.0.0:8080/loginhandler
Unexpected exception in route
java.lang.IllegalStateException: Logged in OK, but no return URL
at io.vertx.ext.web.handler.impl.FormLoginHandlerImpl.lambda$handle$113(FormLoginHandlerImpl.java:78)
at io.vertx.ext.web.handler.impl.FormLoginHandlerImpl$$Lambda$80/1130099548.handle(Unknown Source)
at io.vertx.core.impl.FutureImpl.checkCallHandler(FutureImpl.java:135)
at io.vertx.core.impl.FutureImpl.setHandler(FutureImpl.java:100)
at io.vertx.core.impl.ContextImpl.lambda$null$13(ContextImpl.java:275)
at io.vertx.core.impl.ContextImpl$$Lambda$83/1571927301.handle(Unknown Source)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$15(ContextImpl.java:312)
at io.vertx.core.impl.ContextImpl$$Lambda$6/866191240.run(Unknown Source)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at java.lang.Thread.run(Thread.java:745)

This behaviour happens when

1] If I directly enter the following URL in the browser
http://127.0.0.1:8080/loginpage.html
It does not work even if I access the login page and enter the correct login
and password.

Here is the outcome -> Internal Server Error

2] On the other side, if I enter go directly to home page http://127.0.0.1:8080 and follow the following URL in the browser : http://127.0.0.1:8080/private/private_page.html
It does work.

I think the problem in the routage implementation.
It does not cover the exception when I enter directly the URL in the input bar of the browser.

Thanks.

Kind Regards
Frederic

vert.x gateway with spring security ?

Is vert.x a good candidate to expose to the www as a gateway webapp? Meaning an app that makes use of a service broker, discovers other micro services, sends POST & GET (as needed) requests to them, aggregates responses
Can we apply spring security on a vert.x application? If so do you know of a sample ? Want to benefit from spring's security features and vert.x non blocking advantages.

So as technologies go looking for a gateway example that has spring security for external URLs, uses a service broker, has aggregator code that uses the micro services and does other business logic.

Looking for reference app that sits behind a web server, discovers and uses micro services, applies business logic in spring, while being protected by spring security.

Project fails to build in IntelliJ IDEA because cannot load OSGI plugin

Project... rebuild all gives:

Error:osgi: [osgi-examples] Failed to load plugin org.apache.felix.ipojo.bnd.PojoizationPlugin;, error: org.apache.felix.ipojo.bnd.PojoizationPlugin not found, parent: java.net.URLClassLoader@45ee12a7 urls:[] exception:java.lang.ClassNotFoundException: org.apache.felix.ipojo.bnd.PojoizationPlugin

This means I can't run the examples in the IDE

core HA example doesn't run on command line

If you follow the instructions to run it as described in the README it fails when starting the first Server:

/home/tim/projects/vert-x3/vertx-examples/core-examples/src/main/java/io/vertx/example/util/Runner.java:15: error: cannot find symbol
ExampleRunner.runJavaExample(CORE_EXAMPLES_JAVA_DIR, clazz, true);
^
symbol: variable ExampleRunner
location: class io.vertx.example.util.Runner
/home/tim/projects/vert-x3/vertx-examples/core-examples/src/main/java/io/vertx/example/util/Runner.java:19: error: cannot find symbol
ExampleRunner.runJavaExample(CORE_EXAMPLES_JAVA_DIR, clazz, false);
^
symbol: variable ExampleRunner
location: class io.vertx.example.util.Runner
/home/tim/projects/vert-x3/vertx-examples/core-examples/src/main/java/io/vertx/example/util/Runner.java:25: error: cannot find symbol
ExampleRunner.runScriptExample(CORE_EXAMPLES_JS_DIR, scriptName, false);

Example of inter verticle communication

Hello all,

I have the following scenario: there are two simple services written using Spring boot and deployed as two verticles in vert.x

I want the two services to communicate (publish and subscribe events) using the event bus provided by vert.x. I followed the examples in GitHub with respect to publish / subscribe and point to point eventing mechanisms.

I started the services using java -jar under different ports and there is no error. However, I don't see the messages at the receiver side. I have started the two services in clustered mode programmatically.

Can somebody point me to examples of such kind so that I can resolve this problem?

Thanks,
Krishnaprasad

Web upload example fails

when run in IDE:

io.vertx.core.file.FileSystemException: java.nio.file.NoSuchFileException: /home/tim/projects/vert-x3/vertx-examples/web-examples/src/main/java/io/vertx/example/web/upload/file-uploads/686a502b-988a-4263-bb57-b66d2f25ed40
at io.vertx.core.file.impl.AsyncFileImpl.(AsyncFileImpl.java:104)
at io.vertx.core.file.impl.FileSystemImpl.doOpen(FileSystemImpl.java:744)
at io.vertx.core.file.impl.FileSystemImpl$14.perform(FileSystemImpl.java:738)
at io.vertx.core.file.impl.FileSystemImpl$14.perform(FileSystemImpl.java:735)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:281)
at io.vertx.core.impl.ContextImpl$$Lambda$24/907322897.run(Unknown Source)
at io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$217(OrderedExecutorFactory.java:91)
at io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor$$Lambda$3/1452012306.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.nio.file.NoSuchFileException: /home/tim/projects/vert-x3/vertx-examples/web-examples/src/main/java/io/vertx/example/web/upload/file-uploads/686a502b-988a-4263-bb57-b66d2f25ed40
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newAsynchronousFileChannel(UnixFileSystemProvider.java:196)
at java.nio.channels.AsynchronousFileChannel.open(AsynchronousFileChannel.java:248)
at io.vertx.core.file.impl.AsyncFileImpl.(AsyncFileImpl.java:101)
... 10 more

Not able to run the angular app from Eclipse IDE.

I am running the io/vertx/example/web/angularjs/Server.java. The server starts to listen on 8080. I go to the browser and type url http://localhost:8080 and i get the response as 'Not Found'. I check the console in Eclipse it shows something like this,

Route matches: Route[ path:null pattern:null handler:io.vertx.ext.web.handler.impl.StaticHandlerImpl@99ce62c failureHandler:null order:7 methods:[]]@435222730
Calling the handler
File to serve is webroot/index.html

It is not able to serve the index.html file. What can be the problem?

Vertx getting start

The examples are great but what I can't figure out how to start. There were different folder structure followed and most of it doesn't gave the idea of abstractions one should big in a big microservice architecture. Some of the example files contains too much code which is generally broken into multiple class files. They are absolutely fine with respect to examples but don't give an idea how to build.

Is it possible to publish same basic structure for creating a microservice based architecture with some conventions as

  • Recommended module/ventricle structure (assembly,mod.xml, mod.Json. how to use them proficiently)

  • Place holders for config files and env based config files, application.properties, application-dev.properties

  • Is YML based config files supported.

  • Some more ideas which translates in convention over configurations, providing that many IDE not have active plugins to suggest them.

  • Standard to dos and dont's when some one trying to adopt.

  • There is vertx gradle plugin at the same time shadow plugin is used mainly

    I definitely don't want to compare it with springboot but they have a great consistencies between examples, like if you explore JPA example and then explore rest repositories, you would find absolute same packaging structures with respect to JPA entities/repositories. Something that would be really great for starters.

Please share your experiences as beginners guide about how vertx helped/may help in maintaining big projects >1 million lines of code.

Thanks for great work.

sync example failing when running quasar with verify-instrumentation

I am running on a windows box

Steps:

  1. add the java agent as jvm arguments
  2. add -Dco.paralleluniverse.fibers.verifyInstrumentation=true
  3. Run io.vertx.example.sync.fiberhandler.Server

It seems to work but its actually not correct.

Stack trace here
http://pastebin.com/Wk6qvTXH

WARNING: Uninstrumented methods (marked '*') or call-sites (marked '!!') detected on the call stack:
at io.vertx.example.sync.fiberhandler.Server.lambda$start$9(io.vertx.core.eventbus.EventBus,io.vertx.core.http.HttpServerRequest) (Server.java:45 bci: 6) *

the code there looks like this. I guess somehow there's a problem with fiberHandler.

Message reply = awaitResult(h -> eb.send(ADDRESS, "blah", h));

Some examples should be self contained

Some examples such as maven-simplest, maven-verticle should be self contained - i.e. they should not have a parent pom, so users can easily copy and paste them into their own projects.

However I can't figure out how to do this, as it seems I can only specify relativePath if there is a parent, but in this case there is no parent.

We should also consider making ALL examples independent with their own independent poms for easier copying and pasting.

@cescoffier you might find this of interest :)

Duplicated Service Registration in OSGi-example

In VertxActivator, method start :

public void start(BundleContext context) throws Exception {
LOGGER.info("Creating Vert.x instance");
Vertx vertx = Vertx.vertx();
vertxRegistration = context.registerService(Vertx.class, vertx, null);
LOGGER.info("Vert.x service registered");
vertxRegistration = context.registerService(Vertx.class, vertx, null); //Duplicated Registration
LOGGER.info("Vert.x Event Bus service registered");
ebRegistration = context.registerService(EventBus.class, vertx.eventBus(), null);
}

Deployment failed on synchronous deployment example of ruby.

I tried to run vertx-examples/core-examples/src/main/rb/io/vertx/example/core/verticle/asyncstart/deployexample.rb but the deployment of deployexample.rb failed with the following output:

5 08, 2015 1:26:35 午後 io.vertx.core.impl.BlockedThreadChecker
警告: Thread Thread[vert.x-eventloop-thread-1,5,main] has been blocked for 2154 ms time 2000000000
5 08, 2015 1:26:36 午後 io.vertx.core.impl.BlockedThreadChecker
警告: Thread Thread[vert.x-eventloop-thread-1,5,main] has been blocked for 3154 ms time 2000000000
Main verticle has started, let's deploy some others...
In OtherVerticle.start (async)
5 08, 2015 1:26:37 午後 io.vertx.core.Starter
情報: Succeeded in deploying verticle
Startup tasks are now complete, OtherVerticle is now started!
5 08, 2015 1:26:39 午後 io.vertx.core.impl.DeploymentManager
重大: Failure in calling handler
org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `print_stack_trace' for "e07ea47a-5eca-4ab3-aaf4-7de76c61558a":String
    at RUBY.Mod___VertxInternalVert__1(deployexample.rb:21)
    at RUBY.deploy_verticle(file:/C:/Users/tajimaj/.m2/repository/io/vertx/vertx-lang-ruby/3.0.0-SNAPSHOT/vertx-lang-ruby-3.0.0-20150507.212529-9.jar!/vertx/vertx.rb:277)
    at org.jruby.gen.InterfaceImpl1533925801.handle(org/jruby/gen/InterfaceImpl1533925801.gen:13)

I think, from the following code, that the order of parameters of block is res_err, res:

https://github.com/vert-x3/vertx-lang-ruby/blob/master/src/main/resources/vertx/vertx.rb#L277

redisexample: cannot find symbol

I was trying to use java example for redisexample. I use Maven to manage dependency. I have vertx-redis-client in my pom.xml file.
However, when I run mvn clean compile. it shows cannot find symbol [ERROR] symbol: class RedisOptions.

It does not have any problem with import io.vertx.redis.RedisClient;

How can i reload in IDEA?

I used IDEA write vert.x program but when i change the code i have to manually redeploy program.
how can i reload in IDEA , or another way?

Vertxbus Webpack doesn't show output

Noticed a webpack example. Followed the steps in the Readme.md and visited http://localhost:8080/index.html.

I briefly see Connecting followed by - flash across the screen, then nothing.

Can see events coming through in the console so guessing an issue lies somewhere in the the client app side?

Class path troubles

I'm not sure if the problem is the start script in examples or is it in general how Vertx works, therefore I will report/ask it here and if necessary I will move this to another place.

So in some of the examples I saw that there is a run command like this used:

vertx run io.vertx.example.SampleVerticle -cp build/libs/*

I tried to leverage this to include module dependencies as separate JARs beside the verticle JAR, so I put all the dependencies into build/libs/dependencies/ and tried following:

vertx run io.vertx.example.SampleVerticle -cp build/libs/*:build/libs/dependencies/*

in contrast to above command, this one did not work, I steadily get class not found. However if I list all of the JAR files instead of using wild card this works. Is it intentional that this parameter is the same as -cp from Java's command line tool but does not work the same way?

you can see the experimental code here (99% similar to examples):
https://github.com/mohamnag/vertx-3-bootstrap

Web example instructions slightly off regarding use of Auth

In the instructions for the Vertx web examples it states:

If you’re using auth in your Vert.x-Web application you will also need the dependency:

Group ID: io.vertx
Artifact ID: vertx-auth

However, currently that dependency is to a pure POM which does not actually provide the needed JARs (at least it doesn't for Gradle and I presume for Maven as well). The dependency that you actually need is vertx-auth-common plus whichever auth implementation you want to use.

IME vertx-auth-common is required whether or not you actually use the auth mechanisms (due to internal dependencies on User required to create a Router).

Remove HelloConfigurableVerticle from Maven verticle

I think it's important that the example is simple and just contains a single verticle.

If we want to demonstrate config being passed I think we can just edit HelloWorldVerticle to display it.

Also I don't really understand why the docs for the example use vertx run not java -jar like the other examples.

Resolve npm modules using npm executable

When deploying an npm module from Vert.x, if the module is not installed already and the user has the npm executable installed we could call that to resolve the modules and dependencies from the remote npm repo before deploying it.

Vert.x 3.2.0 doesn't run ceylon examples

Hi all!
Although I can run examples via ceylon:
$ ceylon compile examples.web.helloworld
Note: Created module examples.web.helloworld/1.0.0
$ ceylon run examples.web.helloworld
Deployed examples.web.helloworld example

I can't do the same via vertx, even if I use simple helloworld example from readme.adoc:
$vertx run ceylon:source/examples/web/helloworld
This might be a type checker bug, please report.
Expecting to add missing dependency error on non present definition: cannot find module artifact com.redhat.ceylon.compiler.java-1.2.0(.car|.jar)
- dependency tree: ceylon.language/1.2.0 -> com.redhat.ceylon.compiler.java/1.2.0
This might be a type checker bug, please report.
Expecting to add missing dependency error on non present definition: cannot find module artifact com.redhat.ceylon.compiler.js-1.2.0(.car|.jar)
- dependency tree: ceylon.language/1.2.0 -> com.redhat.ceylon.compiler.js/1.2.0
This might be a type checker bug, please report.
Expecting to add missing dependency error on non present definition: cannot find module artifact com.redhat.ceylon.common-1.2.0(.car|.jar)
- dependency tree: ceylon.language/1.2.0 -> com.redhat.ceylon.common/1.2.0
This might be a type checker bug, please report.
Expecting to add missing dependency error on non present definition: cannot find module artifact com.redhat.ceylon.model-1.2.0(.car|.jar)
- dependency tree: ceylon.language/1.2.0 -> com.redhat.ceylon.model/1.2.0
This might be a type checker bug, please report.
Expecting to add missing dependency error on non present definition: cannot find module artifact com.redhat.ceylon.module-resolver-1.2.0(.car|.jar)
- dependency tree: ceylon.language/1.2.0 -> com.redhat.ceylon.module-resolver/1.2.0
This might be a type checker bug, please report.
Expecting to add missing dependency error on non present definition: cannot find module artifact com.redhat.ceylon.typechecker-1.2.0(.car|.jar)
- dependency tree: ceylon.language/1.2.0 -> com.redhat.ceylon.typechecker/1.2.0
This might be a type checker bug, please report.
Expecting to add missing dependency error on non present definition: cannot find module artifact org.jboss.modules-1.3.3.Final(.car|.jar)
- dependency tree: ceylon.language/1.2.0 -> org.jboss.modules/1.3.3.Final
This might be a type checker bug, please report.
Expecting to add missing dependency error on non present definition: cannot find module artifact org.jboss.jandex-1.0.3.Final(.car|.jar)
- dependency tree: ceylon.language/1.2.0 -> org.jboss.jandex/1.0.3.Final
Compilation error at (3,3) in vertx-examples/ceylon/source/examples/web/helloworld/module.ceylon:cannot find module artifact examples.utils-1.0.0(.car|.jar)
- dependency tree: examples.web.helloworld/1.0.0 -> examples.utils/1.0.0
java.lang.Exception: Could not compile
at io.vertx.lang.ceylon.CeylonVerticleFactory.compileModules(CeylonVerticleFactory.java:189)
at io.vertx.lang.ceylon.CeylonVerticleFactory.createVerticle(CeylonVerticleFactory.java:104)
at io.vertx.core.impl.DeploymentManager.createVerticles(DeploymentManager.java:186)
at io.vertx.core.impl.DeploymentManager.lambda$null$151(DeploymentManager.java:143)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$15(ContextImpl.java:296)
at io.vertx.core.impl.OrderedExecutorFactory$OrderedExecutor.lambda$new$261(OrderedExecutorFactory.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Failed in deploying verticle

I don't know if it's a bug or my mistake anywhere, but it asked me to report this, so I do.

AMD example is not working

The AMD example (web) using bower does not work. The eventbus object cannot be instantiated as the EventBus variable is '3' (which is obviously not a function)

nullpointer exception

I used the exactly same example code from java redis example. I use maven to compile and package.

    final RedisClient client = RedisClient.create(vertx,
        new RedisOptions().setHost("127.0.0.1"));
java.lang.NullPointerException
at io.vertx.redis.impl.AbstractRedisClient.<init>(AbstractRedisClient.java:44)
at io.vertx.redis.impl.RedisClientImpl.<init>(RedisClientImpl.java:39)
at io.vertx.redis.RedisClient.create(RedisClient.java:49)
at ccproject.q2.<init>(q2.java:54)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at io.vertx.core.impl.JavaVerticleFactory.createVerticle(JavaVerticleFactory.java:44)
at io.vertx.core.impl.DeploymentManager.createVerticles(DeploymentManager.java:186)
at io.vertx.core.impl.DeploymentManager.lambda$doDeployVerticle$153(DeploymentManager.java:159)
at io.vertx.core.impl.FutureImpl.checkCallHandler(FutureImpl.java:135)
at io.vertx.core.impl.FutureImpl.setHandler(FutureImpl.java:100)
at io.vertx.core.impl.DeploymentManager.doDeployVerticle(DeploymentManager.java:132)
at io.vertx.core.impl.DeploymentManager.doDeployVerticle(DeploymentManager.java:104)
at io.vertx.core.impl.DeploymentManager.deployVerticle(DeploymentManager.java:92)
at io.vertx.core.impl.VertxImpl.deployVerticle(VertxImpl.java:557)
at io.vertx.core.Starter.runVerticle(Starter.java:333)
at io.vertx.core.Starter.run(Starter.java:130)
at io.vertx.core.Starter.main(Starter.java:101)

I solved it. Redis.create should be inside start()

using AMD in verticle on the server.

Could javascript verticle have support for AMD. That would allow to use requirejs in verticle. Hence allow parts of the controller from the client side to be used in the verticle.

Intelligent current working directory resolution

The current examples, when running in the IDE using ExampleRunner assume that the IDE working directory is set up to be the root directory of the vertx-examples project.

This is the case when running in IntelliJ but behaviour can vary in other IDEs, e.g. in Eclipse and NetBeans which set the cwd to be the directory of the Maven sub-module (e.g. the core-examples directory). This can result in examples that use file system access failing for those IDEs when running in the IDE.

To remedy this we can do some "intelligent" cwd resolution in the ExampleRunner class. We can detect the cwd being used with new File(".") and based on the path of that and the desired working directory we can calculate the cwd offset to use. This should work if the actual cwd is set to anything below the project root.

keystore and static ressources not found

Hi,

I am trying to launch the custom_authorisation example in vertx web exemple. I have the following error:

java.io.FileNotFoundException: /home/ragulan/NetBeansProjects/vertx-examples/web-examples/web-examples/src/main/java/io/vertx/example/web/custom_authorisation/keystore.jceks (No such file or directory)
java.lang.RuntimeException: java.io.FileNotFoundException: /home/ragulan/NetBeansProjects/vertx-examples/web-examples/web-examples/src/main/java/io/vertx/example/web/custom_authorisation/keystore.jceks (No such file or directory)
at io.vertx.ext.auth.jwt.impl.JWTAuthProviderImpl.(JWTAuthProviderImpl.java:71)
at io.vertx.ext.auth.jwt.JWTAuth.create(JWTAuth.java:41)
at io.vertx.example.web.custom_authorisation.Server.start(Server.java:30)
at io.vertx.core.AbstractVerticle.start(AbstractVerticle.java:111)
at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$169(DeploymentManager.java:407)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$15(ContextImpl.java:314)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.FileNotFoundException: /home/ragulan/NetBeansProjects/vertx-examples/web-examples/web-examples/src/main/java/io/vertx/example/web/custom_authorisation/keystore.jceks (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.(FileInputStream.java:138)
at io.vertx.ext.auth.jwt.impl.JWTAuthProviderImpl.(JWTAuthProviderImpl.java:61)
... 9 more

It works fine when I change the path as follow:

JWTAuth jwt = JWTAuth.create(vertx, new JsonObject()
        .put("keyStore", new JsonObject()
            .put("type", "jceks")
            .put("path", "/home/ragulan/NetBeansProjects/vertx-examples/web-examples/src/main/java/io/vertx/example/web/custom_authorisation/keystore.jceks")
            .put("password", "secret")));

Static ressources are not found too. When I go on http://localhost:8080/ I have the message "Not Found" (index.html not found I think, like the issue #61 ).

Can someone help me please ?

Could not find artifacts

I tried to build the whole vertx-examples project via maven mvn clean install command, but all the vertx related artifacts are cannot find.

vertx:vertx-lang-js:jar:3.0.0-SNAPSHOT, io.vertx:vertx-lang-groovy:jar:3.0.0-SNAPSHOT, io.vertx:vertx-lang-ruby:jar:3.0.0-SNAPSHOT: Could not find artifact io.vertx:vertx-core:jar:3.0.0-SNAPSHOT -> [Help 1]

vertx-web templating example doesn't work with 3.1-SNAPSHOT

The file vertx-examples/web-examples/src/main/js/io/vertx/example/web/templating/mvel/server.js doesn't run anymore with the latest snapshot because vertx-web-js/mvel_template_engine.js does not exist anymore.

Does the example need to be fixed or am I doing something wrong?

Cheers,
Michel

eventbus/pointtopoint doesn't work on different nodes

I run Receiver as Java app on node A and Sender as Java app on node B. I don't use Multicast, I use tcp-ip. They can join in cluster.

Then Receiver says:

Members [2] {
    Member [192.168.0.10]:5701 this
    Member [192.168.0.20]:5701
}

Nov 29, 2015 1:44:51 AM com.hazelcast.partition.InternalPartitionService
INFO: [192.168.0.10]:5701 [dev] [3.5.2] Re-partitioning cluster data... Migration queue size: 135
Nov 29, 2015 1:44:54 AM com.hazelcast.partition.InternalPartitionService
INFO: [192.168.0.10]:5701 [dev] [3.5.2] All migration tasks have been completed, queues are empty.

And no messages from Sender to Receiver...

After 30 sec Sender starts saying:

Message reply handler timed out as no reply was received - it will be removed 
No reply
Message reply handler timed out as no reply was received - it will be removed 
No reply

What could be wrong?

Interesting that when I run both verticles like this:
$ vertx run Receiver.java -cluster
$ vertx run Sender.java -cluster

They do send messages to each other.

If I run one of them with vertx command and the other as Java app - they don't.

My cluster.xml in CLASSPATH for both Receiver and Sender (according to http://talc1.loria.fr/users/cerisara/posts/vertx_clustering.html):

<join>
            <multicast enabled="false">
                <multicast-group>224.2.2.3</multicast-group>
                <multicast-port>54327</multicast-port>
            </multicast>
            <tcp-ip enabled="true">
                <interface>192.168.0.10</interface>
            </tcp-ip>
            <aws enabled="false">
                <access-key>my-access-key</access-key>
                <secret-key>my-secret-key</secret-key>
                <!--optional, default is us-east-1 -->
                <region>us-west-1</region>
                <!--optional, default is ec2.amazonaws.com. If set, region shouldn't be set as it will override this property -->
                <host-header>ec2.amazonaws.com</host-header>
                <!-- optional, only instances belonging to this group will be discovered, default will try all running instances -->
                <security-group-name>hazelcast-sg</security-group-name>
                <tag-key>type</tag-key>
                <tag-value>hz-nodes</tag-value>
            </aws>
        </join>

Improve error handling in JDBC examples

The examples in https://github.com/vert-x3/vertx-examples/tree/master/jdbc-examples/src/main/java/io/vertx/example/jdbc have inadequate error handling. One could argue that the error handling doesn't have be perfect in examples, but given that this kind of error handling is tricky I think it would serve really well with some good examples on how to do it properly.

To be more concrete, here are some things I noticed:

Vertx 3 IsCluster property missing

I can enable clustering and ha at the command line, e.g.
Cluster mode.
java -jar target/maven-verticle-3.0.0-SNAPSHOT-fat.jar -cluster

Non-cluster mode
java -jar target/maven-verticle-3.0.0-SNAPSHOT-fat.jar

My question is how do I get to know if the user is running in cluster mode or not?
If clustered, I need to use the sharedData.getClusterWideMap other wise getLocalMap.

Any attempt to call sharedData.getClusterWideMap while not running in cluster will
throw an exception.

SEVERE: Unhandled exception
java.lang.IllegalStateException: Can't get cluster wide map if not clustered
        at io.vertx.core.shareddata.impl.SharedDataImpl.getClusterWideMap(Shared
DataImpl.java:60)  

Mail-service not woking

Hello

I am trying to run the vertx mail-service examples. The verticle gets started but the mail is not being sent.

Following is what i am doing in a start method of a verticle

MailConfig mailConfig = new MailConfig()
.setHostname("smtp.gmail.com")
.setPort(465)
.setStarttls(StartTLSOptions.REQUIRED)
.setLogin(LoginOption.REQUIRED)
.setAuthMethods("PLAIN")
.setUsername("[email protected]")
.setPassword("abc");

    MailClient mailClient = MailClient.createShared(vertx, mailConfig);

    MailMessage email = new MailMessage()
            .setFrom("[email protected]")
            .setTo("[email protected]")
            .setSubject("Test email with HTML")
            .setText("this is a message")
            .setHtml("<a href=\"http://vertx.io\">vertx.io</a>");

    mailClient.sendMail(email, result -> {
        if (result.succeeded()) {
            System.out.println(result.result());
        } else {
            System.out.println("got exception");
            result.cause().printStackTrace();
        }
    });
}

When sendMail is called, its handler is never called. no action is performed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.