Vert.x学习

思想

各个可重用模块之间的交流和解耦,通过异步IO和消息总线

How Vert.x locates modules (太重要了这个)

Vert.x looks in the following places:
If the module is being deployed from another module it will look for a nested mods directory inside the current module. See the section onnested modules.
In the local mods directory on the filesystem, or in the directory specified by the VERTX_MODS environment variable, if set.
In the sys-mods directory of the Vert.x installation.

如何打包一个Module

  1. 首先你得知道那个结构,然后按着结构去造就好了,但是我觉得它应该有统一的编译工具会好点
    http://vertx.io/mods_manual.html#the-structure-of-a-module

  2. 打成zip的原因是,打成jar会很奇怪,明明里头没有java或者是class文件

    The structure of a module
    A Vert.x module is a zip file which contains the resources (.class files, .java files, script files, jar files and other resources) needed by your module.
    In some ways it is similar to a jar file used in the Java world. We deliberately did not use jar files for Vert.x modules because Vert.x is a polyglot system and a particular module might, for instance, only contain python scripts, so using a Java archive for this would be somewhat strange!

  3. 现在的话,人家都是用maven或者是gradle来build,有点不伦不类s

如何开始一个vertx module的构建

虽然不喜欢,但是还是要用maven来构建一个vertx 最简单的 module
在开始的时候你不知道太多的参数,所以用最简单的就好了
具体可以看这里http://vertx.io/maven_dev.html

mvn archetype:generate -Dfilter=io.vertx: -DgroupId=com.mycompany -DartifactId=my-module -Dversion=0.1

完事之后用mvn install就可以生成
The Vert.x module zip file.
A jar that corresponds to the module. This is useful when you have another project which depends on the classes from your module, as it allows you to add it as a dependency to your other project.

Vertx能做什么(我的想法)

  1. 就像HTTP刚出来的时候一样,这个东西为一个实现提供了各种可能性,现在Server已经有很多种实现了,但是基于HTTP还不够
  2. 前端直接和EventBus通信,这个太bug了,现在你可以完全只写前端代码(包括DAO),然后跟EventBus通信,后台用一个mongo-persistor(虽然有安全问题)
  3. 模块之间的DeCouple

你可能感兴趣的:(Vert.x学习)