Giter VIP home page Giter VIP logo

vertx-microservices-workshop's Introduction

Vert.x - From zero to (micro-) hero.

This repository is a lab about vert.x explaining how to build distributed microservice reactive applications using Vert.x.

Instructions are available on http://escoffier.me/vertx-hol

Complete code is available in the solution directory.

Teasing

Vert.x is a toolkit to create reactive distributed applications running on the top of the Java Virtual Machine. Vert.x exhibits very good performances, and a very simple and small API based on the asynchronous, non-blocking development model. With vert.x, you can developed microservices in Java, but also in JavaScript, Groovy, Ruby and Ceylon. Vert.x also lets you interact with Node.JS, .NET or C applications.

This lab is an introduction to microservice development using Vert.x. The application is a fake trading application, and maybe you are going to become (virtually) rich! The applications is a federation of interaction microservices packaged as fat-jar and creating a cluster.

Content

  • Vert.x
  • Microservices
  • Asynchronous non-blocking development model
  • Composition of async operations
  • Distributed event bus
  • Database access
  • Providing and Consuming REST APIs
  • Async RPC on the event bus
  • Microservice discovery

Want to improve this lab ?

Forks and PRs are definitely welcome !

Building

To build the code:

mvn clean install

To build the documentation:

cd docs
docker run -it -v `pwd`:/documents/ asciidoctor/docker-asciidoctor "./build.sh" "html"
# or for fish
docker run -it -v (pwd):/documents/ asciidoctor/docker-asciidoctor "./build.sh" "html"

vertx-microservices-workshop's People

Contributors

abdlquadri avatar anhldbk avatar btison avatar cescoffier avatar ctron avatar dancingfrog avatar davidaparicio avatar dependabot[bot] avatar dmitriid avatar emmanuelrosa avatar francescoborzi avatar honeyandsw avatar kpranith avatar mahaswami avatar sczyh30 avatar tsegismont avatar vietj avatar w7089 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

vertx-microservices-workshop's Issues

io.vertx.core.impl.ContextImpl: Unsupported service type message-source error for multiple Javatrader

https://github.com/cescoffier/vertx-microservices-workshop/blob/master/solution/compulsive-traders/src/main/java/io/vertx/workshop/trader/impl/JavaCompulsiveTraderVerticle.java

Hi Clement, I followed your training, and when I deployed the JavaCompulsiveTraderVerticle, I got the below error if I deploy more than one of them. This error only shows up for multiple JavaTraders, not for multiple GroovyTraders.

I did a clean checkout and try to use your solution, the same error still persists. Could you please take a look?

INFO: Discovery importer io.vertx.servicediscovery.docker.DockerLinksServiceImporter@660c7311 started

Jun 25, 2016 8:13:31 AM io.vertx.core.impl.ContextImpl
SEVERE: Unhandled exception
java.lang.IllegalArgumentException: Unsupported service type message-source
at io.vertx.servicediscovery.impl.ServiceTypes.get(ServiceTypes.java:43)
at io.vertx.servicediscovery.impl.DiscoveryImpl.getReferenceWithConfiguration(DiscoveryImpl.java:108)
at io.vertx.servicediscovery.impl.DiscoveryImpl.getReference(DiscoveryImpl.java:103)
at io.vertx.servicediscovery.types.MessageSource.lambda$getConsumer$0(MessageSource.java:136)
at io.vertx.servicediscovery.impl.DiscoveryImpl.lambda$getRecord$6(DiscoveryImpl.java:275)
at io.vertx.servicediscovery.impl.DefaultServiceDiscoveryBackend.lambda$getRecords$4(DefaultServiceDiscoveryBackend.java:100)
at io.vertx.core.impl.FutureImpl.checkCallHandler(FutureImpl.java:158)
at io.vertx.core.impl.FutureImpl.setHandler(FutureImpl.java:100)
at io.vertx.core.impl.ContextImpl.lambda$null$1(ContextImpl.java:315)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$3(ContextImpl.java:359)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:339)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:393)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:742)
at java.lang.Thread.run(Thread.java:745)

Documentation fix

INSTALL.md just mentions to copy parent pom to repository which doesn't install the pom and hence build of other module fails.

Please add below to documentation

mvn install:install-file -Dpackaging=pom -Dfile=/.m2/repository/io/vertx/workshop/vertx-microservice-workshop/1.0-SNAPSHOT/vertx-microservice-workshop-1.0-SNAPSHOT.pom.xml -DpomFile=/.m2/repository/io/vertx/workshop/vertx-microservice-workshop/1.0-SNAPSHOT/vertx-microservice-workshop-1.0-SNAPSHOT.pom.xml

src/conf/config.json?

The problem

6.4 in the docs reads:

This command launch the application. The main class we used creates a clustered Vert.x instance and read the configuration from src/conf/config.json. This configuration provides the HTTP port on which the REST service is published (35000).

Let’s now open a browser and have a look to http://localhost:35000.

Unfortunately:

  • RestQuoteAPIVerticle does not read any configuration
  • the server is started with a hardcoded :8080

If the reader is required to change configs (to add http.port) and add reading configs to the code, it's not stated anywhere.

However, even adding http.port to quote-generator/src/conf/config.json and config().getInteger("http.port", 8080) to RestQuoteAPIVerticle doesn't help.

When the service starts, it never reads the config, config() returns {}.

Request

Please extend the tutorial with:

  • a section on how config files are found by services (and how to place them in a different directory, or resources)
  • code and explanation (at least, for quote generator) showing what changes need to be done to configs for it to work as described in the tutorial

How to build individual modules without installing parent project

I began the tutorial believing that I would be able to compile, package and install individual modules as the tutorial chapters progressed. However, if one does not begin by running mvn clean install in the project root, which means installing all of the modules into the user's local repository, the only module that can be built in isolation is vertx-workshop-common.

This seems counter-intuitive to me, as many of the source files in each module are incomplete. Does this mean that the parent pom is configured to compile sources from the solutions directory and ignore the src directories of each individual modules?

Also, if I were beginning this project from scratch, how would I progressively create each module, knowing that the parent project could not be installed until all of the child modules were complete?

audit-service fails to load after the other components are up.

[INFO] Reactor Summary:
[INFO]
[INFO] vertx-microservice-workshop ........................ SUCCESS [ 2.208 s]
[INFO] vertx-workshop-common .............................. SUCCESS [ 4.765 s]
[INFO] quote-generator .................................... SUCCESS [ 10.839 s]
[INFO] portfolio-service .................................. SUCCESS [ 7.528 s]
[INFO] audit-service ...................................... SUCCESS [ 3.877 s]
[INFO] compulsive-traders ................................. SUCCESS [ 3.506 s]
[INFO] trader-dashboard ................................... SUCCESS [ 4.402 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 37.704 s
[INFO] Finished at: 2016-09-27T19:11:51-07:00
[INFO] Final Memory: 62M/305M
[INFO] ------------------------------------------------------------------------

| => java -jar target/quote-generator-1.0-SNAPSHOT-fat.jar
Members [1] {
Member [127.0.0.1]:5701 this
}

Sep 27, 2016 7:12:18 PM com.hazelcast.core.LifecycleService
INFO: [127.0.0.1]:5701 [dev] [3.6.3] Address[127.0.0.1]:5701 is STARTED
Sep 27, 2016 7:12:18 PM com.hazelcast.partition.InternalPartitionService
INFO: [127.0.0.1]:5701 [dev] [3.6.3] Initializing cluster partition table arrangement...
Reading config file: /Users/arisco97/workspace/vertx-microservices-workshop/quote-generator/src/conf/config.json
Sep 27, 2016 7:12:19 PM io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer
INFO: Succeeded in deploying verticle
Market-Data service published : true
Quotes (Rest endpoint) service published : true
Server started

| => java -jar target/trader-dashboard-1.0-SNAPSHOT-fat.jar
Members [2] {
Member [127.0.0.1]:5701
Member [127.0.0.1]:5702 this
}

Sep 27, 2016 7:13:13 PM com.hazelcast.core.LifecycleService
INFO: [127.0.0.1]:5702 [dev] [3.6.3] Address[127.0.0.1]:5702 is STARTED
Config file not found /Users/arisco97/workspace/vertx-microservices-workshop/trader-dashboard/src/conf/config.json
Sep 27, 2016 7:13:14 PM io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer
INFO: Succeeded in deploying verticle

| => java -jar target/portfolio-service-1.0-SNAPSHOT-fat.jar
Members [3] {
Member [127.0.0.1]:5701
Member [127.0.0.1]:5702
Member [127.0.0.1]:5703 this
}

Sep 27, 2016 7:13:44 PM com.hazelcast.core.LifecycleService
INFO: [127.0.0.1]:5703 [dev] [3.6.3] Address[127.0.0.1]:5703 is STARTED
Config file not found /Users/arisco97/workspace/vertx-microservices-workshop/portfolio-service/src/conf/config.json
Portfolio service published : true
Sep 27, 2016 7:13:45 PM io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer
INFO: Succeeded in deploying verticle
Portfolio Events service published : true

| => java -jar target/compulsive-traders-1.0-SNAPSHOT-fat.jar
Members [4] {
Member [127.0.0.1]:5701
Member [127.0.0.1]:5702
Member [127.0.0.1]:5703
Member [127.0.0.1]:5704 this
}

Sep 27, 2016 7:14:16 PM com.hazelcast.map.impl.query.MapQueryEngineImpl
INFO: [127.0.0.1]:5704 [dev] [3.6.3] Partition assignments changed while executing query: TruePredicate{}
Sep 27, 2016 7:14:17 PM com.hazelcast.core.LifecycleService
INFO: [127.0.0.1]:5704 [dev] [3.6.3] Address[127.0.0.1]:5704 is STARTED
Config file not found /Users/arisco97/workspace/vertx-microservices-workshop/compulsive-traders/src/conf/config.json
Java compulsive trader configured for company Divinator and shares: 4
Sep 27, 2016 7:14:18 PM io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer
INFO: Succeeded in deploying verticle

| => java -jar target/audit-service-1.0-SNAPSHOT-fat.jar
Members [5] {
Member [127.0.0.1]:5701
Member [127.0.0.1]:5702
Member [127.0.0.1]:5703
Member [127.0.0.1]:5704
Member [127.0.0.1]:5705 this
}

Sep 27, 2016 7:14:50 PM com.hazelcast.nio.tcp.SocketAcceptorThread
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Accepting socket connection from /127.0.0.1:52757
Sep 27, 2016 7:14:50 PM com.hazelcast.nio.tcp.TcpIpConnectionManager
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Established socket connection between /127.0.0.1:5705 and /127.0.0.1:52757
Sep 27, 2016 7:14:50 PM com.hazelcast.nio.tcp.InitConnectionTask
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Connecting to /127.0.0.1:5704, timeout: 0, bind-any: true
Sep 27, 2016 7:14:50 PM com.hazelcast.nio.tcp.TcpIpConnectionManager
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Established socket connection between /127.0.0.1:52758 and /127.0.0.1:5704
Sep 27, 2016 7:14:52 PM com.hazelcast.core.LifecycleService
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Address[127.0.0.1]:5705 is STARTED
Reading config file: /Users/arisco97/workspace/vertx-microservices-workshop/audit-service/src/conf/config.json
Sep 27, 2016 7:14:53 PM com.mchange.v2.log.MLog
INFO: MLog clients using java 1.4+ standard logging.
Sep 27, 2016 7:14:53 PM com.mchange.v2.c3p0.C3P0Registry
INFO: Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10]
Sep 27, 2016 7:14:53 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> 1hge16l9juohgt41la3sag|6b2b20a6, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> null, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1hge16l9juohgt41la3sag|6b2b20a6, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:hsqldb:file:audit-db;shutdown=true, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:414)
at sun.nio.ch.Net.bind(Net.java:406)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:127)
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:554)
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1258)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:511)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:496)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:980)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:250)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:363)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasksFrom(SingleThreadEventExecutor.java:394)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:369)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:433)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
at java.lang.Thread.run(Thread.java:745)
Sep 27, 2016 7:14:53 PM io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer
SEVERE: Failed in deploying verticle
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:414)
at sun.nio.ch.Net.bind(Net.java:406)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:127)
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:554)
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1258)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:511)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:496)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:980)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:250)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:363)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasksFrom(SingleThreadEventExecutor.java:394)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:369)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:433)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
at java.lang.Thread.run(Thread.java:745)

java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:414)
at sun.nio.ch.Net.bind(Net.java:406)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:127)
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:554)
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1258)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:511)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:496)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:980)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:250)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:363)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasksFrom(SingleThreadEventExecutor.java:394)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:369)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:433)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
at java.lang.Thread.run(Thread.java:745)
Sep 27, 2016 7:14:53 PM com.hazelcast.core.LifecycleService
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Address[127.0.0.1]:5705 is SHUTTING_DOWN
Sep 27, 2016 7:14:53 PM com.hazelcast.instance.Node
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Shutting down connection manager...
Sep 27, 2016 7:14:53 PM com.hazelcast.nio.tcp.TcpIpConnection
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Connection [Address[127.0.0.1]:5701] lost. Reason: Socket explicitly closed
Sep 27, 2016 7:14:53 PM com.hazelcast.nio.tcp.TcpIpConnection
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Connection [Address[127.0.0.1]:5702] lost. Reason: Socket explicitly closed
Sep 27, 2016 7:14:53 PM com.hazelcast.nio.tcp.TcpIpConnection
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Connection [Address[127.0.0.1]:5703] lost. Reason: Socket explicitly closed
Sep 27, 2016 7:14:53 PM com.hazelcast.nio.tcp.TcpIpConnection
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Connection [Address[127.0.0.1]:5704] lost. Reason: Socket explicitly closed
Sep 27, 2016 7:14:53 PM com.hazelcast.nio.tcp.TcpIpConnection
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Connection [Address[127.0.0.1]:5704] lost. Reason: Socket explicitly closed
Sep 27, 2016 7:14:53 PM com.hazelcast.instance.Node
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Shutting down node engine...
Sep 27, 2016 7:14:54 PM com.hazelcast.instance.NodeExtension
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Destroying node NodeExtension.
Sep 27, 2016 7:14:54 PM com.hazelcast.instance.Node
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Hazelcast Shutdown is completed in 233 ms.
Sep 27, 2016 7:14:54 PM com.hazelcast.core.LifecycleService
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Address[127.0.0.1]:5705 is SHUTDOWN

What am i missing?

I also tried launching trader-dashboard as the last verticle. In this case the audit-service launched properly, but the trader-dashboard failed.

| => java -jar target/audit-service-1.0-SNAPSHOT-fat.jar
Members [4] {
Member [127.0.0.1]:5701
Member [127.0.0.1]:5702
Member [127.0.0.1]:5703
Member [127.0.0.1]:5704 this
}

Sep 27, 2016 7:25:57 PM com.hazelcast.core.LifecycleService
INFO: [127.0.0.1]:5704 [dev] [3.6.3] Address[127.0.0.1]:5704 is STARTED
. . . .
Sep 27, 2016 7:26:09 PM com.hazelcast.cluster.ClusterService
INFO: [127.0.0.1]:5704 [dev] [3.6.3]

Members [5] {
Member [127.0.0.1]:5701
Member [127.0.0.1]:5702
Member [127.0.0.1]:5703
Member [127.0.0.1]:5704 this
Member [127.0.0.1]:5705 //trader-dashboard was introduced into cluster.
}

Sep 27, 2016 7:26:09 PM com.hazelcast.nio.tcp.InitConnectionTask
INFO: [127.0.0.1]:5704 [dev] [3.6.3] Connecting to /127.0.0.1:5705, timeout: 0, bind-any: true
Sep 27, 2016 7:26:09 PM com.hazelcast.nio.tcp.TcpIpConnectionManager
INFO: [127.0.0.1]:5704 [dev] [3.6.3] Established socket connection between /127.0.0.1:52895 and /127.0.0.1:5705
Sep 27, 2016 7:26:12 PM com.hazelcast.nio.tcp.TcpIpConnection
INFO: [127.0.0.1]:5704 [dev] [3.6.3] Connection [Address[127.0.0.1]:5705] lost. Reason: Socket explicitly closed //connection to trader-dashboard lost.

| => java -jar target/trader-dashboard-1.0-SNAPSHOT-fat.jar
Members [5] {
Member [127.0.0.1]:5701
Member [127.0.0.1]:5702
Member [127.0.0.1]:5703
Member [127.0.0.1]:5704
Member [127.0.0.1]:5705 this
}

Sep 27, 2016 7:26:09 PM com.hazelcast.nio.tcp.SocketAcceptorThread
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Accepting socket connection from /127.0.0.1:52895
Sep 27, 2016 7:26:09 PM com.hazelcast.nio.tcp.TcpIpConnectionManager
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Established socket connection between /127.0.0.1:5705 and /127.0.0.1:52895
Sep 27, 2016 7:26:11 PM com.hazelcast.core.LifecycleService
INFO: [127.0.0.1]:5705 [dev] [3.6.3] Address[127.0.0.1]:5705 is STARTED
Config file not found /Users/arisco97/workspace/vertx-microservices-workshop/trader-dashboard/src/conf/config.json
java.net.BindException: Address already in use

DashboardVerticle fails

even run the services from solution folder, it fails. Problems are:

  1. where to put the method "failureAwarelastOperations" ?
  2. there is not method of "callAuditServiceWithExceptionHandlerWithCircuitBreaker" at "DashboardVertical" inside of solution folder? Even I copy it to there, the compilation fails.

Could you help me? Thanks!

Chain may loose exception

Have found Chain class in the vertx wishlist.

I think that every Function.apply should be wrapped in try / catch block as it may throw an exception which would not be propagated to returned future.

Workshop on OpenShift - multicast issue

I have the trader-dashboard verticle unable to join the cluster with the quote-generator, all running on OpenShift.

Logs from the trader-dashboard logs-
INFO: [127.0.0.1]:5701 [dev] [3.6.3] Could not connect to: /127.0.0.1:5702. Reason: SocketException[Connection refused to address /127.0.0.1:5702]

  | Jul 19, 2018 5:05:47 AM com.hazelcast.cluster.impl.TcpIpJoiner
  | INFO: [127.0.0.1]:5701 [dev] [3.6.3] Address[127.0.0.1]:5702 is added to the blacklist.
  | Jul 19, 2018 5:05:47 AM com.hazelcast.nio.tcp.InitConnectionTask
  | INFO: [127.0.0.1]:5701 [dev] [3.6.3] Could not connect to: /127.0.0.1:5703. Reason: SocketException[Connection refused to address /127.0.0.1:5703]
  | Jul 19, 2018 5:05:47 AM com.hazelcast.cluster.impl.TcpIpJoiner
  | INFO: [127.0.0.1]:5701 [dev] [3.6.3] Address[127.0.0.1]:5703 is added to the blacklist.
  | Jul 19, 2018 5:05:48 AM com.hazelcast.cluster.impl.TcpIpJoiner
  | INFO: [127.0.0.1]:5701 [dev] [3.6.3]
  |  
  |  
  | Members [1] {
  | Member [127.0.0.1]:5701 this
  | }

Thanks,
Tarun

Document portfolio.adoc code need update

In document portfolio.adoc 8.4.3, there 2 piece of code used HttpClient,
but in solution code, PortfolioServiceImpl used WebClient.

in doc 10.3.2, there 2 lines of vertx.fileSystem().rxReadFile(); need a parameter s.

Anyway, this project teach me a lot. thank you very much!

PortfolioServiceImpl.sendActionOnTheEventBus(): Inconsistent name for the new amount

In section about implementing PortfolioServiceImpl.sendActionOnTheEventBus(), the instructions state that the message being sent must contain a key/value pair named owner, yet the code example uses the name owned:

Write the body of the sendActionOnTheEventBus method in oder to publish a message on the EVENT_ADDRESS address containing a JsonObject as body. This object must contains the following entries:
...
owner → the updated (owned) amount

vertx.eventBus().publish(EVENT_ADDRESS, new JsonObject()
    .put("action", action)
    .put("quote", quote)
    .put("date", System.currentTimeMillis())
    .put("amount", amount)
    .put("owned", newAmount));

See https://github.com/cescoffier/vertx-microservices-workshop/blob/master/docs/chapters/portfolio.adoc This is as of commit efc3712.

Fix CSS issue

When scrolling to the right in the document, something very weird happen....

Failed to encode as JSON: Null key for a Map not allowed in JSON

Hi,

I think that there is an error with the lab content as when we launch the docker container ("docker run -p 8081:8080 --rm --name quote-generator vertx-microservice-workshop/quote-generator"), then the next error appears when we access the following address : http://dockerhost:8081

io.vertx.core.json.EncodeException: Failed to encode as JSON: Null key for a Map not allowed in JSON (use a converting NullKeySerializer?)
        at io.vertx.core.json.Json.encodePrettily(Json.java:73)
        at io.vertx.workshop.quote.RestQuoteAPIVerticle.lambda$start$1(RestQuoteAPIVerticle.java:49)
        at io.vertx.core.http.impl.ServerConnection.handleRequest(ServerConnection.java:286)
        at io.vertx.core.http.impl.ServerConnection.processMessage(ServerConnection.java:412)
        at io.vertx.core.http.impl.ServerConnection.handleMessage(ServerConnection.java:139)
        at io.vertx.core.http.impl.HttpServerImpl$ServerHandler.lambda$createConnAndHandle$1(HttpServerImpl.java:709)
        at io.vertx.core.impl.ContextImpl.lambda$wrapTask$3(ContextImpl.java:357)
        at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:234)

screenshot 2016-05-27 18 32 37

However, the config.json file is well packaged and available within the docker contener

docker exec -it c6649fa1f319 /bin/bash
root@c6649fa1f319:/opt# ls -la 
total 42736
drwxrwxrwx  3 root root     4096 May 27 16:26 .
drwxr-xr-x 56 root root     4096 May 27 16:26 ..
drwxr-xr-x  3 root root     4096 May 27 16:26 .vertx
-rwxrwxrwx  1 root root      410 May 27 06:56 config.json
-rwxrwxrwx  1 root root 43742687 May 27 16:25 quote-generator-1.0-SNAPSHOT-fat.jar

Dependency io.vertx:vertx-core, leading to CVE problem

Hi, In vertx-microservices-workshop/vertx-workshop-common,there is a dependency io.vertx:vertx-core:3.4.1 that calls the risk method.

CVE-2019-17640

The scope of this CVE affected version is [3.4.0, 3.9.4)

After further analysis, in this project, the main Api called is <io.vertx.core.eventbus.impl.EventBusImpl: boolean deliverMessageLocally(io.vertx.core.eventbus.impl.MessageImpl)>

Risk method repair link : GitHub

CVE Bug Invocation Path--

Path Length : 9

<io.vertx.core.eventbus.impl.EventBusImpl: boolean deliverMessageLocally(io.vertx.core.eventbus.impl.MessageImpl)>
at <io.vertx.core.eventbus.impl.EventBusImpl: void deliverMessageLocally(io.vertx.core.eventbus.impl.EventBusImpl$SendContextImpl)> (io.vertx.core.eventbus.impl.EventBusImpl.java:[347]) in /home/wc/.m2/repository/io/vertx/vertx-core/3.4.1/vertx-core-3.4.1.jar
at <io.vertx.core.eventbus.impl.EventBusImpl: void sendOrPub(io.vertx.core.eventbus.impl.EventBusImpl$SendContextImpl)> (io.vertx.core.eventbus.impl.EventBusImpl.java:[320]) in /home/wc/.m2/repository/io/vertx/vertx-core/3.4.1/vertx-core-3.4.1.jar
at <io.vertx.core.eventbus.impl.EventBusImpl$SendContextImpl: void next()> (io.vertx.core.eventbus.impl.EventBusImpl$SendContextImpl.java:[450]) in /home/wc/.m2/repository/io/vertx/vertx-core/3.4.1/vertx-core-3.4.1.jar
at <io.vertx.core.eventbus.impl.EventBusImpl: void sendOrPubInternal(io.vertx.core.eventbus.impl.MessageImpl,io.vertx.core.eventbus.DeliveryOptions,io.vertx.core.Handler)> (io.vertx.core.eventbus.impl.EventBusImpl.java:[418]) in /home/wc/.m2/repository/io/vertx/vertx-core/3.4.1/vertx-core-3.4.1.jar
at <io.vertx.core.eventbus.impl.EventBusImpl: io.vertx.core.eventbus.EventBus publish(java.lang.String,java.lang.Object,io.vertx.core.eventbus.DeliveryOptions)> (io.vertx.core.eventbus.impl.EventBusImpl.java:[131]) in /home/wc/.m2/repository/io/vertx/vertx-core/3.4.1/vertx-core-3.4.1.jar
at <io.vertx.core.eventbus.impl.EventBusImpl: io.vertx.core.eventbus.EventBus publish(java.lang.String,java.lang.Object)> (io.vertx.core.eventbus.impl.EventBusImpl.java:[126]) in /home/wc/.m2/repository/io/vertx/vertx-core/3.4.1/vertx-core-3.4.1.jar
at <io.vertx.servicediscovery.impl.DiscoveryImpl: void publish(io.vertx.servicediscovery.Record,io.vertx.core.Handler)> (io.vertx.servicediscovery.impl.DiscoveryImpl.java:[305]) in /home/wc/.m2/repository/io/vertx/vertx-service-discovery/3.4.1/vertx-service-discovery-3.4.1.jar
at <io.vertx.workshop.common.MicroServiceVerticle: void publish(io.vertx.servicediscovery.Record,io.vertx.core.Handler)> (io.vertx.workshop.common.MicroServiceVerticle.java:[64]) in /home/wc/detect/unzip/vertx-microservices-workshop-master/vertx-workshop-common/target/classes

Dependency tree--

[INFO] io.vertx.workshop:vertx-workshop-common:jar:1.0-SNAPSHOT
[INFO] +- io.vertx:vertx-rx-java:jar:3.4.1:compile
[INFO] |  \- io.reactivex:rxjava:jar:1.2.7:compile
[INFO] +- io.vertx:vertx-core:jar:3.4.1:compile
[INFO] |  +- io.netty:netty-common:jar:4.1.8.Final:compile
[INFO] |  +- io.netty:netty-buffer:jar:4.1.8.Final:compile
[INFO] |  +- io.netty:netty-transport:jar:4.1.8.Final:compile
[INFO] |  +- io.netty:netty-handler:jar:4.1.8.Final:compile
[INFO] |  |  \- io.netty:netty-codec:jar:4.1.8.Final:compile
[INFO] |  +- io.netty:netty-handler-proxy:jar:4.1.8.Final:compile
[INFO] |  |  \- io.netty:netty-codec-socks:jar:4.1.8.Final:compile
[INFO] |  +- io.netty:netty-codec-http:jar:4.1.8.Final:compile
[INFO] |  +- io.netty:netty-codec-http2:jar:4.1.8.Final:compile
[INFO] |  +- io.netty:netty-resolver:jar:4.1.8.Final:compile
[INFO] |  +- io.netty:netty-resolver-dns:jar:4.1.8.Final:compile
[INFO] |  |  \- io.netty:netty-codec-dns:jar:4.1.8.Final:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-core:jar:2.7.4:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.7.4:compile
[INFO] |     \- com.fasterxml.jackson.core:jackson-annotations:jar:2.7.0:compile
[INFO] +- io.vertx:vertx-service-proxy:jar:processor:3.4.1:compile
[INFO] +- io.vertx:vertx-lang-groovy:jar:3.4.1:compile
[INFO] |  \- org.codehaus.groovy:groovy-all:jar:2.4.7:compile
[INFO] +- io.vertx:vertx-lang-js:jar:3.4.1:compile
[INFO] +- io.vertx:vertx-codegen:jar:3.4.1:compile
[INFO] |  \- org.mvel:mvel2:jar:2.2.8.Final:compile
[INFO] +- io.vertx:vertx-sockjs-service-proxy:jar:3.4.1:compile
[INFO] |  \- io.vertx:vertx-service-proxy:jar:3.4.1:compile
[INFO] +- io.vertx:vertx-web:jar:3.4.1:compile
[INFO] |  \- io.vertx:vertx-auth-common:jar:3.4.1:compile
[INFO] +- io.vertx:vertx-web-client:jar:3.4.1:compile
[INFO] |  \- io.vertx:vertx-web-common:jar:3.4.1:compile
[INFO] +- io.vertx:vertx-hazelcast:jar:3.4.1:compile
[INFO] |  \- com.hazelcast:hazelcast:jar:3.6.3:compile
[INFO] +- io.vertx:vertx-service-discovery:jar:3.4.1:compile
[INFO] +- io.vertx:vertx-circuit-breaker:jar:3.4.1:compile
[INFO] |  \- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile

Suggested solutions:

Update dependency version

Thank you very much.

Cannot build docs

docker run -it -v $(pwd):/documents/ asciidoctor/docker-asciidoctor "./build.sh" "html"

output:

Converting to HTML ...
mv: cannot stat 'chapters/*.png': No such file or directory

GroovyVerticle fails to run

GRAVE: No signature of method: static io.vertx.servicediscovery.types.MessageSource.getConsumer() is applicable for argument types: (io.vertx.servicediscovery.impl.DiscoveryImpl, java.util.LinkedHashMap, io.vertx.core.impl.FutureImpl) values: [io.vertx.servicediscovery.impl.DiscoveryImpl@1c36f9, [name:market-data], ...]
groovy.lang.MissingMethodException: No signature of method: static io.vertx.servicediscovery.types.MessageSource.getConsumer() is applicable for argument types: (io.vertx.servicediscovery.impl.DiscoveryImpl, java.util.LinkedHashMap, io.vertx.core.impl.FutureImpl) values: [io.vertx.servicediscovery.impl.DiscoveryImpl@1c36f9, [name:market-data], ...]
	at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1503)
	at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1489)
	at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:53)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:141)
	at GroovyCompulsiveTraderVerticle.run(GroovyCompulsiveTraderVerticle.groovy:22)
	at io.vertx.lang.groovy.ScriptVerticle.start(ScriptVerticle.java:64)
	at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$8(DeploymentManager.java:434)
	at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:337)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:445)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
	at java.lang.Thread.run(Thread.java:748)

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.