Vert.x 3.1.0 Service Tutorial
2015年11月7日
[前置き]
Vert.x 3.0よりv直接classnameもしくはscript nameを利用しdeployせずに,
ServicVerticleFactoryを利用しdeployすることが可能。
[Tutorial]
1.pom.xmlに以下のService Factory Dependencyを追加
<dependency> <groupId>io.vertx</groupId> <artifactId>vertx-service-factory</artifactId> <version>3.0.0</version> </dependency>
ServiceFactoryはservice nameを元にverticleをdeployするためのVeticleFactoryの実装
2.First Sample Service – Serviceが呼び出されたら”This is my test service”を出力
package biz.playport.vertx.services; import io.vertx.core.AbstractVerticle; import io.vertx.core.logging.Logger; import io.vertx.core.logging.LoggerFactory; /** * Created by bhags on 15/11/07. */ public class FirstServiceVerticle extends AbstractVerticle { private final static Logger log = LoggerFactory.getLogger(FirstServiceVerticle.class); @Override public void start(){ log.info("This is my test service"); } }
3.Serviceを呼び側
参考URL
https://github.com/vert-x3/vertx-service-factory
https://groups.google.com/forum/?hl=ja#!searchin/vertx/Service/vertx/vezlmH-H4NI/uBe9iM5Z1U8J
http://qiita.com/p-baleine@github/items/d26999fe42ace182aca1
Vert.x
To do list -
1.Vert.x用 + message pack用のjava socket libraryを構築
2.multi port를 쓰는것이 좋은가?
3.vertx에서
서비스 만들기
서비스 쓰기
서비스 프록시 쓰기
Vert.x 3 Tutorials
1. Start with maven
To run with maven
mvn compile exec:java
To build a “fat jar”
mvn package
To run the fat jar:
java -jar target/maven-simplest-3.1.0-fat.jar
>>(You can take that jar and run it anywhere there is a Java 8+ JDK. It contains all the dependencies it needs so you don’t need to install Vert.x on the target machine).
1.
Comments are closed.