I'm using Eclipse for the posting but you can use any environment you would like.
This will be an ongoing blog.
Vertxio One: Getting a Vertxio and Gradle up and running.
Vertxio Two: JMeter First Blush
1) You will need JAVA 8 and Vertxio 3.
2) Create a Gradle Project.

3) Edit gradle.build - copy and paste. Then add your class under the NOTE comment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'java' | |
id 'application' | |
id 'com.github.johnrengelman.shadow' version '1.2.2' | |
} | |
dependencies { | |
compile 'io.vertx:vertx-core:3.0.0' | |
} | |
repositories { | |
mavenCentral() | |
} | |
//NOTE: Add your class here | |
def mainVerticleDemo = "groovy:vertxio.demo.MyDemo" | |
mainClassName = "io.vertx.core.Starter" | |
run { | |
args = ["run", mainVerticleDemo] | |
} | |
jar { | |
manifest { | |
attributes 'Main-Verticle': mainVerticleDemo | |
} | |
} | |
shadowJar { | |
classifier = 'fat' | |
mergeServiceFiles { | |
include 'META-INF/services/io.vertx.core.spi.VerticleFactory' | |
} | |
dependencies { | |
exclude(dependency('io.vertx:codegen')) | |
exclude(dependency('junit:junit')) | |
exclude(dependency('org.mvel:mvel2')) | |
exclude(dependency('log4j:log4j')) | |
} | |
} |
4) Update dependencies

5) Create class that extends AbstractVerticle.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package vertxio.demo; | |
import io.vertx.core.AbstractVerticle; | |
public class MyDemo extends AbstractVerticle{ | |
public void start(){ | |
vertx.createHttpServer() | |
.requestHandler(req -> { | |
req.response().putHeader("content-type", "text/html") | |
.end("<html><body><h1>Hello from vert.x!</h1></body></html>"); | |
}).listen(8080); | |
} | |
} |
6) Run and open in a browser.
http://vertxio3-and-gradle.blogspot.com/2015/08/vertxio-two-jmeter-first-blush.html
No comments:
Post a Comment