How-to use Vert.x

Documents for the development of and with JVx.

How-to use Vert.x

Postby Development@SIB » Thu Jan 24, 2013 6:33 pm

The integration of JVx in a Vert.x environment is very easy because JVx has a ready-to-use connector. Firstly, you have to start a Vert.x server (HttpServer or NetServer). We provide a simple class that starts a server and automatically uses JVx:

Simply execute (use ; instead of : on windows):

Code: Select all
java -DConfiguration.basedir=/path/to/rad_parent -cp jvx.jar:jvxvertx.jar:<your_application.jar> com.sibvisions.vertx.NetSocketServer -cluster-host=<ip or hostname>

Set Configuration.basedir to the directory that contains your rad directory. This is important, otherwise JVx does not find your application(s). The rad directory structure is as usual.

In your client application, simple use NetSocketConnection if you are using NetSocketServer or JVx' standard HttpConnection if you're using HttpServer.

Example:

Code: Select all
NetSocketConnection con = new NetSocketConnection(<ip or hostname>);
         
MasterConnection macon = new MasterConnection(con);
macon.setApplicationName(<application>);
macon.setUserName(<username>);
macon.setPassword(<password>);
macon.open();

That's it.

Now your application works without application server like JBoss or Tomcat, but you're able to use all JVx features for your application.
User avatar
Development@SIB
 
Posts: 311
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation