LoginSignup
4
4

More than 5 years have passed since last update.

Vert.x 3 でのEventbusサンプルの動かし方

Last updated at Posted at 2015-07-03

概要

Vert.x 3.0.0のサンプルに入っているEventbusを介したサーバー・クライアントのサンプルプログラムの動かし方のメモです。

追記(2016/2/9)

CentOS 7にて実行してみたところうまく動作しないので、調べてみたところ、Firewall-cmdでUDPのポートを開ける必要がありました。

firewall-cmd --add-port=54327/udp --zone=public --permanent

ポートNoは、Vertxインストールフォルダ配下にある、default-cluster.xmlに記載されているポート番号となります。

cluster オプション

Eventbusを介して、プロセス間で通信するには、-clusterオプションを引数に渡します。

# サーバー側
$ cd core-examples/src/main/groovy/io/vertx/example/core/eventbus/pointtopoint
$ vertx run receiver.groovy -cluster 
# クライアント側
$ cd core-examples/src/main/groovy/io/vertx/example/core/eventbus/pointtopoint
$ vertx run sender.groovy -cluster 

サーバープロセスの追加

サーバー側プロセスをもう1つ追加したい場合も同様に別ターミナルで-clusterオプションを指定して起動するだけです。

Eventbus(プロセス間)の通信設定

$VERTX_HOME/conf/default-cluster.xml に サーバー間の通信設定が記載されています。
通信モードは3つあるようです。
* udp(デフォルト)
* tcp
* aws

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4