Recent Changes - Search:

edit SideBar

UpgradeFromVertX2ToVertX3

The idea is to update Ptolemy II from Vert.x 2 to 3.

Resources

How to get access to the branch

Check out the branch with:

   svn co https://repo.eecs.berkeley.edu/svn/projects/eal/ptII/branches/vertx-3-0-0 ptIIv3

Current status

25-Sep-2015: imports are fixed. jjs/modules/httpClient/HttpClientHelper.java compiles. Still to go: other files that use vert.x

  • 44 ant errors, down from 67.

Notes below here about how the port was done.

Ptolemy Branch

I created a branch with

  svn copy https://repo.eecs.berkeley.edu/svn/projects/eal/ptII/trunk 
https://repo.eecs.berkeley.edu/svn/projects/eal/ptII/branches/vertx-3-0-0
-m "Creating Ptolemy II branch for building with Vert.x 3.0.0. See https://www.terraswarm.org/testbeds/wiki/Vert/UpgradeFrom2To3."

The above step is already done, you do not need to do it again

To check out the branch, use:

   svn co https://repo.eecs.berkeley.edu/svn/projects/eal/ptII/branches/vertx-3-0-0 ptIIv3

Which version of Vert.x 3.0?

In $PTII/lib, we are using the following Vert.x 2.x jars that have corresponding jars in 3.x:

  • hazelcast-*.jar
  • jackson-annotations-*.jar
  • jackson-core-*.jar
  • jackson-databind-*.jar
  • vertx-core-*.jar
  • vertx-hazelcast-*.jar

These Vert.x 2.x jars do not have direct replacements in 3.x:

  • java-xmlhttprequest-*.jar
  • netty-all-*.jar

https://github.com/vert-x3/vertx-stack/blob/master/README.md states that the Vert.x min distribution has:

  • Vert.x Core
  • Groovy, JS and Ruby languages
  • Hazelcast clustering
  • Service proxy

Let's start with that and see what else is necessary.

Adding the Vert.x 3.0 jars to the ptII branch

These steps have already been done for you and is in the ptII vert-3-0-0 branch

Delete the Vert.x 2.x jars from the branch :

cd ptIIv3
export PTII=`pwd`
svn delete hazelcast-3.2.3.jar jackson-annotations-2.2.2.jar jackson-core-2.2.2.jar jackson-databind-2.2.2.jar java-xmlhttprequest-20140923.jar netty-all-4.0.21.Final.jar vertx-*.jar

Copy jar files from the Vert.x 3.0 directory:

cd vendors
wget https://bintray.com/artifact/download/vertx/downloads/vert.x-3.0.0-min.tar.gz
tar -zxf vert.x-3.0.0-min.tar.gz
cd ..
cp ~/vendors/vert.x-3.0.0/lib/{hazelcast-*.jar,jackson-annotations*.jar,jackson-core*.jar,jackson-databind*.jar,vertx*.jar,netty*.jar} .

FIXME: We probably don't need vertx-lang-groovy-3.0.0.jar or vertx-lang-ruby-3.0.0.jar.

FIXME: Update license files for these jar files.

Add the jar files to the branch:

svn add lib/{hazelcast-*.jar,jackson-annotations*.jar,jackson-core*.jar,jackson-databind*.jar,vertx*.jar,netty*.jar}

Edit configure.in and change:

            # Keep these alphabetic                                                                                                    
            # Vert.x 2.x jars:                                                                                                          
            #jars="hazelcast-*.jar jackson-annotations-*.jar jackson-core-*.jar jackson-databind-*.jar java-xmlhttprequest-*.jar netty-\
all-*.jar vertx-core-*.jar vertx-hazelcast-*.jar vertx-platform-*.jar"                                                                  

            # Vert.x 3.x jars:                                                                                                          
            jars="hazelcast-*.jar jackson-annotations-*.jar jackson-core-*.jar jackson-databind-*.jar netty-buffer-*.jar netty-codec-[^\
h]*.jar netty-codec-http-*.jar netty-common-*.jar netty-handler-*.jar vertx-core-*.jar vertx-hazelcast-*.jar vergx-lang-js-3.0.0.jar ve\
rtx-service-proxy-*.jar"

Configure the system. We use --enable-verbose to get more information:

bash-3.2$ autoconf
bash-3.2$ ./configure --enable-verbose

You should see something like:

 checking for the Vertx application platform interface. ... ${CLASSPATHSEPARATOR}/Users/cxh/src/ptIIv3/lib/hazelcast-3.5.jar${CLASSPATHSEPARATOR}/Users/cxh/src/ptIIv3/lib/jackson-annotations-2.5.0.jar${CLASSPATHSEPARATOR}/Users/cxh/src/ptIIv3/lib/jackson-core-2.5.3.jar${CLASSPATHSEPARATOR}/Users/cxh/src/ptIIv3/lib/jackson-databind-2.5.3.jar${CLASSPATHSEPARATOR}/Users/cxh/src/ptIIv3/lib/netty-buffer-4.0.28.Final.jar${CLASSPATHSEPARATOR}${CLASSPATHSEPARATOR}/Users/cxh/src/ptIIv3/lib/netty-codec-http-4.0.28.Final.jar${CLASSPATHSEPARATOR}/Users/cxh/src/ptIIv3/lib/netty-common-4.0.28.Final.jar${CLASSPATHSEPARATOR}/Users/cxh/src/ptIIv3/lib/netty-handler-4.0.28.Final.jar${CLASSPATHSEPARATOR}/Users/cxh/src/ptIIv3/lib/vertx-core-3.0.0.jar${CLASSPATHSEPARATOR}/Users/cxh/src/ptIIv3/lib/vertx-hazelcast-3.0.0.jar${CLASSPATHSEPARATOR}${CLASSPATHSEPARATOR}/Users/cxh/src/ptIIv3/lib/vertx-service-proxy-3.0.0.jar

Also, the new jars should be in .classpath and build.xml

Build

Run ant which we expect to fail.

Ptolemy II files that use Vert.x

bash-3.2$ cat /tmp/j | xargs grep import | grep org.vertx | awk -F : '{print $1}'  | sort | uniq
./ptolemy/actor/lib/jjs/modules/VertxHelperBase.java
./ptolemy/actor/lib/jjs/modules/browser/VertxBrowserHelper.java
./ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java
./ptolemy/actor/lib/jjs/modules/httpClient/HttpClientHelper.java
./ptolemy/actor/lib/jjs/modules/udpSocket/UDPSocketHelper.java
./ptolemy/actor/lib/jjs/modules/vertxEventBus/VertxHelper.java
./ptolemy/actor/lib/jjs/modules/webSocket/WebSocketHelper.java
./ptolemy/actor/lib/jjs/modules/webSocket/WebSocketServerHelper.java
./ptolemy/actor/lib/vertx/EventBusTestServer.java
./ptolemy/actor/lib/vertx/VertxBusHandler.java

Place these file names in a file so that we can run scripts on the files:

cat /tmp/j | xargs grep import | grep org.vertx | awk -F : '{print $1}'  | sort | uniq > /tmp/jv

Vert.x 2.x classes used in Ptolemy II

bash-3.2$ $PTII/adm/bin/ptIItxtfiles > /tmp/f
bash-3.2$ cat /tmp/f | egrep "\.java$" > /tmp/j
bash-3.2$ cat /tmp/j | xargs grep import | grep org.vertx | awk '{print $NF}'  | sort | uniq -c | sort -nr
   9 org.vertx.java.core.Handler;
   5 org.vertx.java.core.buffer.Buffer;
   5 org.vertx.java.core.VertxFactory;
   5 org.vertx.java.core.Vertx;
   4 org.vertx.java.core.http.HttpServer;
   4 org.vertx.java.core.http.HttpClient;
   3 org.vertx.java.core.json.JsonObject;
   3 org.vertx.java.core.http.WebSocket;
   3 org.vertx.java.core.http.HttpServerRequest;
   3 org.vertx.java.core.AsyncResult;
   2 org.vertx.java.core.sockjs.SockJSServer;
   2 org.vertx.java.core.json.JsonArray;
   2 org.vertx.java.core.eventbus.Message;
   2 org.vertx.java.core.eventbus.EventBus;
   2 org.vertx.java.core.VoidHandler;
   1 org.vertx.java.platform.Verticle;
   1 org.vertx.java.core.http.WebSocketBase;
   1 org.vertx.java.core.http.ServerWebSocket;
   1 org.vertx.java.core.http.HttpServerResponse;
   1 org.vertx.java.core.http.HttpClientResponse;
   1 org.vertx.java.core.http.HttpClientRequest;
   1 org.vertx.java.core.datagram.InternetProtocolFamily;
   1 org.vertx.java.core.datagram.DatagramSocket;
   1 org.vertx.java.core.datagram.DatagramPacket;
   1 org.vertx.java.core.MultiMap;
   1 org.vertx.java.core.AsyncResultHandler;
bash-3.2$

Package Change

Checklist for Migrating from Vert.x 2.1.x to Vert.x 3 - Part One says:

"Change all the imports for Vertx. from org.vertx to io.vertx."

I used a script for this.

Run ant

Errors are:

    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/VertxHelperBase.java:30: error: package io.vertx.java.core does not exist
    [javac] import io.vertx.java.core.Vertx;
    [javac]                          ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/VertxHelperBase.java:31: error: package io.vertx.java.core does not exist
    [javac] import io.vertx.java.core.VertxFactory;
    [javac]                          ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/VertxHelperBase.java:62: error: cannot find symbol
    [javac]     protected static Vertx _vertx = VertxFactory.newVertx();
    [javac]                      ^
    [javac]   symbol:   class Vertx
    [javac]   location: class VertxHelperBase
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/browser/VertxBrowserHelper.java:33: error: package io.vertx.java.core does not exist
    [javac] import io.vertx.java.core.AsyncResult
    [javac]                          ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/browser/VertxBrowserHelper.java:34: error: package io.vertx.java.core does not exist
    [javac] import io.vertx.java.core.Handler;
    [javac]                          ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/browser/VertxBrowserHelper.java:35: error: package io.vertx.java.core does not exist
    [javac] import io.vertx.java.core.Vertx;
    [javac]                          ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/browser/VertxBrowserHelper.java:36: error: package io.vertx.java.core does not exist
    [javac] import io.vertx.java.core.VertxFactory;
    [javac]                          ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/browser/VertxBrowserHelper.java:37: error: package io.vertx.java.core.http does not exist
    [javac] import io.vertx.java.core.http.HttpServer;
    [javac]                               ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/browser/VertxBrowserHelper.java:38: error: package io.vertx.java.core.http does not exist
    [javac] import io.vertx.java.core.http.HttpServerRequest;
    [javac]                               ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/browser/VertxBrowserHelper.java:39: error: package io.vertx.java.core.http does not exist
    [javac] import io.vertx.java.core.http.HttpServerResponse;
    [javac]                               ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/browser/VertxBrowserHelper.java:133: error: cannot find symbol
    [javac]     private static Vertx _vertx = VertxFactory.newVertx();
    [javac]                    ^
    [javac]   symbol:   class Vertx
    [javac]   location: class VertxBrowserHelper
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:36: error: package io.vertx.java.core does\
 not exist
    [javac] import io.vertx.java.core.Handler;
    [javac]                          ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:37: error: package io.vertx.java.core does\
 not exist
    [javac] import io.vertx.java.core.Vertx;
    [javac]                          ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:38: error: package io.vertx.java.core does\
 not exist
    [javac] import io.vertx.java.core.VertxFactory;
    [javac]                          ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:39: error: package io.vertx.java.core.even\
tbus does not exist
    [javac] import io.vertx.java.core.eventbus.EventBus;
    [javac]                                   ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:40: error: package io.vertx.java.core.eventbus does not exist
    [javac] import io.vertx.java.core.eventbus.Message;
    [javac]                                   ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:278: error: cannot find symbol
    [javac]     private Map<String, Handler> _subscriptions;
    [javac]                         ^
    [javac]   symbol:   class Handler
    [javac]   location: class EventBusHelper
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:281: error: cannot find symbol
    [javac]     private static Vertx _unclusteredVertxInstance;
    [javac]                    ^
    [javac]   symbol:   class Vertx
    [javac]   location: class EventBusHelper
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:287: error: cannot find symbol
    [javac]     private Vertx _vertx;
    [javac]             ^
    [javac]   symbol:   class Vertx
    [javac]   location: class EventBusHelper
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:290: error: cannot find symbol
    [javac]     private static Map<String, Map<Integer, Vertx>> _vertxInstances;
    [javac]   symbol:   class Vertx
    [javac]   location: class EventBusHelper
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/httpClient/HttpClientHelper.java:48: error: package io.vertx.java.core does\
 not exist
    [javac] import io.vertx.java.core.Handler;
    [javac]                          ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/

Convert io.vertx.java to io.vertx

io.vertx.java.core.Vertx is now io.vertx.core.Vertx as defined in lib/vertx-core-3.0.0.jar, so we change the io.vertx.java to io.vertx using a script.

Run ant

Convert io.vertx.core.VertxFactory to io.vertx.core.spi.VertxFactory

Make the update

Run ant

 [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/udpSocket/UDPSocketHelper.java:40: error: cannot find symbol
    [javac] import io.vertx.core.datagram.InternetProtocolFamily;
    [javac]                              ^
    [javac]   symbol:   class InternetProtocolFamily
    [javac]   location: package io.vertx.core.datagram
 

Replace io.vertx.core.datagram.InternetProtocolFamily with io.vertx.core.datagram.impl.InternetProtocolFamily;

package io.vertx.core.sockjs does not exist

ant says:

    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/vertxEventBus/VertxHelper.java:44: error: package io.vertx.core.sockjs does\
 not exist
    [javac] import io.vertx.core.sockjs.SockJSServer;
    [javac]                            ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/vertx/EventBusTestServer.java:38: error: package io.vertx.core.sockjs does not exist
    [javac] import io.vertx.core.sockjs.SockJSServer;

SockJSHandler is found in The Vert.x full download in vertx-web-3.0.0.jar, which was added to $PTII/lib in the vertx-3-0 branch. That jar file was also added to $PTII/configure.in, autoconf was run and then $PTII/configure.

Verticle is missing

    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/vertx/EventBusTestServer.java:39: error: package io.vertx.platform does not exist
    [javac] import io.vertx.platform.Verticle;
    [javac]                         ^
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/vertx/EventBusTestServer.java:50: error: cannot find symbol
    [javac] public class EventBusTestServer extends Verticle {

Checklist for Migrating from Vert.x 2.1.x to Vert.x 3 - Part One says:

"Verticle is now an interface and not a class to extend, so using Groovy as an example you now extend GroovyVerticle. In Java extend AbstractVerticle instead."

So, in actor/lib/vertx/EventBusTestServer.java, import io.vertx.platform.AbstractVerticle; becomes import io.vertx.core.AbstractVerticle; and we extend AbstractVerticle

"Cannot find annotation method 'concrete()' in type 'VertxGen'"

 [javac] /Users/cxh/src/ptIIv3/lib/vertx-core-3.0.0.jar(io/vertx/core/http/WebSocketBase.class): warning: Cannot find annotation method 'concrete()' in type 'VertxGen': class file for io.vertx.codegen.annotations.VertxGen not found

Solution: Downloaded vertx-codegen-3.0.0.jar:

  wget http://central.maven.org/maven2/io/vertx/vertx-codegen/3.0.0/vertx-codegen-3.0.0.jar

added it to lib and added it to configure.in, ran autoconf

"Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider org.netbeans.modules.openide.util.NbBundleProcessor not found"

While running make:

bash-3.2$ pwd
/Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/vertxEventBus
bash-3.2$ make
making jclass in ptolemy/actor/lib/jjs/modules/vertxEventBus/demo
making jclass in ptolemy/actor/lib/jjs/modules/vertxEventBus/demo/VertxBus
making jclass in ptolemy/actor/lib/jjs/modules/vertxEventBus/demo/VertxDateServer
rm -f `basename VertxHelper.java .java`.class
CLASSPATH="../../../../../..:/Users/cxh/src/ptIIv3/lib/js.jar:/Users/cxh/src/ptIIv3/lib/org.apache\
.oltu.oauth2.client-1.0.1-SNAPSHOT.jar:/Users/cxh/src/ptIIv3/lib/org.apache.oltu.oauth2.common-1.0\
.1-SNAPSHOT.jar:/Users/cxh/src/ptIIv3/lib/socketio.jar::/Users/cxh/src/ptIIv3/lib/hazelcast-3.5.ja\
r:/Users/cxh/src/ptIIv3/lib/jackson-annotations-2.5.0.jar:/Users/cxh/src/ptIIv3/lib/jackson-core-2\
.5.3.jar:/Users/cxh/src/ptIIv3/lib/jackson-databind-2.5.3.jar:/Users/cxh/src/ptIIv3/lib/netty-buff\
er-4.0.28.Final.jar::/Users/cxh/src/ptIIv3/lib/netty-codec-http-4.0.28.Final.jar:/Users/cxh/src/pt\
IIv3/lib/netty-common-4.0.28.Final.jar:/Users/cxh/src/ptIIv3/lib/netty-handler-4.0.28.Final.jar:/U\
sers/cxh/src/ptIIv3/lib/vertx-codegen-3.0.0.jar:/Users/cxh/src/ptIIv3/lib/vertx-core-3.0.0.jar:/Us\
ers/cxh/src/ptIIv3/lib/vertx-hazelcast-3.0.0.jar::/Users/cxh/src/ptIIv3/lib/vertx-service-proxy-3.\
0.0.jar:/Users/cxh/src/ptIIv3/lib/vertx-web-3.0.0.jar"
"/System/Library/Frameworks/JavaVM.framewor\
k/Versions/A/Commands/javac"
-g -O VertxHelper.java
error: Bad service configuration file, or exception thrown while constructing Processor object: ja\
vax.annotation.processing.Processor: Provider org.netbeans.modules.openide.util.NbBundleProcessor \
not found
make: *** [VertxHelper.class] Error 1
bash-3.2$

Solution: Intially, I thought the solution was to edit the makefile and add $(PTHOMER_JARS), which is set in mk/ptII.mk:

# Netbeans Jar files necessary for compilation of homer                                            
PTHOMER_JARS =          /Users/cxh/src/ptIIv3/lib/org-openide-util.jar:/Users/cxh/src/ptIIv3/lib/org-openide-util-lookup.jar:/Users/cxh/src/ptIIv3/lib/org-netbeans-api-visual.jar

However, it turns out that the problem was that $PTII/META-INF/services/javax.annotation.processing.Processor existed.

The javac docs say:

"Unless annotation processing is disabled with the -proc:none option, the compiler searches for any annotation processors that are available. The search path can be specified with the -processorpath option; if it is not given, the user class path is used. Processors are located by means of service provider-configuration files named META-INF/services/javax.annotation.processing.Processor on the search path. Such files should contain the names of any annotation processors to be used, listed one per line. Alternatively, processors can be specified explicitly, using the -processor option."

Cannot find symbol VertxHelperBase

VertxHelperBase.java:62: error: cannot find symbol
    protected static Vertx _vertx = VertxFactory.newVertx();
                                                ^
  symbol:   method newVertx()
  location: interface VertxFactory
1 error
3 warnings
 

Solution: "VertxFactory.newVertx()" -> "Vertx.vertx()"

Current Errors

10/29/2015:

   [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:102: error: cannot find symbol
    [javac]                 _unclusteredVertxInstance = VertxFactory.newVertx();
    [javac]                                                         ^
    [javac]   symbol:   method newVertx()
    [javac]   location: interface VertxFactory
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:174: error: no suitable method found for send(String,String,Handler<Message\
>)
    [javac]         bus.send(address, message, newHandler);
    [javac]            ^
    [javac]     method EventBus.<T#1>send(String,Object,Handler<AsyncResult<Message<T#1>>>) is not applicable
    [javac]       (cannot infer type-variable(s) T#1
    [javac]         (argument mismatch; Handler<Message> cannot be converted to Handler<AsyncResult<Message<T#1>>>))
    [javac]     method EventBus.send(String,Object,DeliveryOptions) is not applicable
    [javac]       (argument mismatch; Handler<Message> cannot be converted to DeliveryOptions)
    [javac]     method EventBus.<T#2>send(String,Object,DeliveryOptions,Handler<AsyncResult<Message<T#2>>>) is not applicable
    [javac]       (cannot infer type-variable(s) T#2
    [javac]         (actual and formal argument lists differ in length))
    [javac]   where T#1,T#2 are type-variables:
    [javac]     T#1 extends Object declared in method <T#1>send(String,Object,Handler<AsyncResult<Message<T#1>>>)
    [javac]     T#2 extends Object declared in method <T#2>send(String,Object,DeliveryOptions,Handler<AsyncResult<Message<T#2>>>)
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:214: error: cannot find symbol
    [javac]         bus.registerHandler(address, newHandler);
    [javac]            ^
    [javac]   symbol:   method registerHandler(String,Handler<Message>)
    [javac]   location: variable bus of type EventBus
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:230: error: cannot find symbol
    [javac]                     bus.unregisterHandler(toUnsubscribe, previousHandler);
    [javac]                        ^
    [javac]   symbol:   method unregisterHandler(String,Handler<Message>)
    [javac]   location: variable bus of type EventBus
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:236: error: cannot find symbol
    [javac]                     bus.unregisterHandler(address, previousHandler);
    [javac]                        ^
    [javac]   symbol:   method unregisterHandler(String,Handler<Message>)
    [javac]   location: variable bus of type EventBus
    [javac] /Users/cxh/src/ptIIv3/ptolemy/actor/lib/jjs/modules/eventbus/EventBusHelper.java:251: error: cannot find symbol
    [javac]         _vertx = VertxFactory.newVertx(clusterPort, clusterHostname);
    [javac]                              ^
    [javac]   symbol:   method newVertx(int,String)
    [javac]   location: interface VertxFactory

No suitable method found for send(String,String,Handler<Message>)

EventBusHelper.java:175: error: no suitable method found for send(String,String,Handler<Message>)
        bus.send(address, message, newHandler);
           ^
    method EventBus.<T#1>send(String,Object,Handler<AsyncResult<Message<T#1>>>) is not applicable
      (cannot infer type-variable(s) T#1
        (argument mismatch; Handler<Message> cannot be converted to Handler<AsyncResult<Message<T#1>>>))
    method EventBus.send(String,Object,DeliveryOptions) is not applicable
      (argument mismatch; Handler<Message> cannot be converted to DeliveryOptions)
    method EventBus.<T#2>send(String,Object,DeliveryOptions,Handler<AsyncResult<Message<T#2>>>) is not applicable
      (cannot infer type-variable(s) T#2
        (actual and formal argument lists differ in length))
  where T#1,T#2 are type-variables:
    T#1 extends Object declared in method <T#1>send(String,Object,Handler<AsyncResult<Message<T#1>>>)
    T#2 extends Object declared in method <T#2>send(String,Object,DeliveryOptions,Handler<AsyncResult<Message<T#2>>>)

Docs are at io.vertx.core.eventbus.EventBus

The error is:

Handler<Message> newHandler = new Handler<Message>() {                        
    public void handle(Message message) {                                      
        _vertxBusJS.callMember("notifyReply", replyHandler,                    
            message.body());                                              
        }                                                                          
    };

The fix is:

        Handler<AsyncResult<Message<String>>> newHandler = new Handler<AsyncResult<Message<String>>>() {
            public void handle(AsyncResult<Message<String>> event) {
                _vertxBusJS.callMember("notifyReply", replyHandler,
                        event.result().body());
            }
        };

cannot find registerHandler

EventBusHelper.java:216: error: cannot find symbol
        bus.registerHandler(address, newHandler);
           ^
  symbol:   method registerHandler(String,Handler<Message>)
  location: variable bus of type EventBus
    /** Subscribe to the specified address on the event bus.                              
     *  Whenever an event is published to this address by some                            
     *  client in the event bus cluster, this                                            
     *  method will cause an event with the same name as address to be                    
     *  emitted on the associated JavaScript object                                      
     *  with the message body as the value of the event.                                  
     *  If this object is already subscribed to this address, then                        
     *  do nothing.                                                                      
     *  @param address The address on the bus to subscribe to.                            
     *  @see #unsubscribe(String)                                                        
     */
    public void subscribe(final String address) {
        if (_subscriptions == null) {
            _subscriptions = new HashMap<String, Handler>();
        }
        if (_subscriptions.get(address) != null) {
            return;
        }
        Handler<Message> newHandler = new Handler<Message>() {
            public void handle(Message message) {
                _vertxBusJS.callMember("notify", address, message.body());
                if (_reply != null) {
                    message.reply(_reply);
                }
            }
        };
        _subscriptions.put(address, newHandler);
        EventBus bus = _vertx.eventBus();
        bus.registerHandler(address, newHandler);
    }

The fix:

        Handler<Message<String>> newHandler = new Handler<Message<String>>() {
            public void handle(Message<String> message) {
                _vertxBusJS.callMember("notify", address, message.body());
                if (_reply != null) {
                    message.reply(_reply);
                }
            }
        };
        _subscriptions.put(address, newHandler);
        EventBus bus = _vertx.eventBus();
        bus.consumer(address, newHandler);

Edit - History - Print - Recent Changes - Search
Page last modified on November 06, 2015, at 04:17 pm