HEADS-project / training

Training material to get started with the HEADS technologies
10 stars 16 forks source link

SAG contribution (2. Kevoree Basics) - only node0 starts #53

Closed skorsky closed 9 years ago

skorsky commented 9 years ago

When I run this example (2.Kevoree_Basics/6.Contrib/SAG) with mvn clean install kev:run, the log shows that only node0 is started (and stopped). Is this true? Model looks OK in the Kevoree editor.

Log: \training\2.Kevoree_Basics\6.Contrib\SAG>mvn clean install kev:run [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Kevoree :: SAG 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ movemessage --- [INFO] Deleting D:\Users\mask\git\skorsky\training\2.Kevoree_Basics\6.Contrib\SAG\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ movemessage --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:\Users\mask\git\skorsky\training\2.Kevoree_Basics\6.Contrib\SAG\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ movemessage --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to D:\Users\mask\git\skorsky\training\2.Kevoree_Basics\6.Contrib\SAG\target\classes [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ movemessage --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:\Users\mask\git\skorsky\training\2.Kevoree_Basics\6.Contrib\SAG\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) @ movemessage --- [INFO] Changes detected - recompiling the module! [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ movemessage --- [INFO] [INFO] --- org.kevoree.tools.mavenplugin:5.2.5:generate (default) @ movemessage --- [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ movemessage --- [INFO] Building jar: D:\Users\mask\git\skorsky\training\2.Kevoree_Basics\6.Contrib\SAG\target\movemessage-1.0.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ movemessage --- [INFO] Installing D:\Users\mask\git\skorsky\training\2.Kevoree_Basics\6.Contrib\SAG\target\movemessage-1.0.0-SNAPSHOT.jar to D:\Users\mask.m2\repository\com\softwareag\research\heads\tutorial\movemes sage\1.0.0-SNAPSHOT\movemessage-1.0.0-SNAPSHOT.jar [INFO] Installing D:\Users\mask\git\skorsky\training\2.Kevoree_Basics\6.Contrib\SAG\pom.xml to D:\Users\mask.m2\repository\com\softwareag\research\heads\tutorial\movemessage\1.0.0-SNAPSHOT\movemessag e-1.0.0-SNAPSHOT.pom [INFO] [INFO] --- org.kevoree.tools.mavenplugin:5.2.5:run (default-cli) @ movemessage --- [INFO] Manually install file:D:\Users\mask\git\skorsky\training\2.Kevoree_Basics\6.Contrib\SAG\target\classes for mvn:com.softwareag.research.heads.tutorial:movemessage:1.0.0-SNAPSHOT 00:00 INFO: Bootstrap Kevoree node : node0, version 5.2.5 00:00 INFO: Load Bootstrap model from D:\Users\mask\git\skorsky\training\2.Kevoree_Basics\6.Contrib\SAG\target\classes\KEV-INF\lib.json 00:00 INFO: Request=JavaNode,JavaNode,JavaNode,com.softwareag.research.heads.tutorial.MoveMessage,com.softwareag.research.heads.tutorial.MoveMessage,com.softwareag.research.heads.tutorial.MoveMessage, WSGroup,SyncBroadcast,SyncBroadcast,SyncBroadcast, 00:01 INFO: Resolved 84 typeDefinitions from Kevoree Registry http://registry.kevoree.org/v5/ (JavaNode/5.2.0,WSGroup/5.2.1-SNAPSHOT,JavaNode/5.0.3,JavaNode/5.2.1,JavaNode/5.0.4,JavaNode/5.2.2,JavaNod e/5.0.5,JavaNode/5.2.3,WSGroup/5.2.4-SNAPSHOT,WSGroup/5.0.8-SNAPSHOT,JavaNode/5.0.6-SNAPSHOT,JavaNode/5.2.4,JavaNode/5.0.6,WSGroup/5.0.5-SNAPSHOT,SyncBroadcast/5.0.7-SNAPSHOT,JavaNode/5.0.7,JavaNode/5 .1.4-SNAPSHOT,JavaNode/5.2.2-SNAPSHOT,JavaNode/5.2.5-SNAPSHOT,WSGroup/5.1.2,WSGroup/5.1.3,SyncBroadcast/5.1.3,WSGroup/5.1.4,WSGroup/5.1.0,WSGroup/5.1.1,SyncBroadcast/5.2.3-SNAPSHOT,JavaNode/5.0.3-SNAP SHOT,JavaNode/5.1.1-SNAPSHOT,SyncBroadcast/5.1.2-SNAPSHOT,SyncBroadcast/5.0.4-SNAPSHOT,JavaNode/5.1.2-SNAPSHOT,SyncBroadcast/5.0.5-SNAPSHOT,SyncBroadcast/5.2.1-SNAPSHOT,WSGroup/5.2.2-SNAPSHOT,WSGroup/ 5.0.7,SyncBroadcast/5.0.3,SyncBroadcast/5.2.1,SyncBroadcast/5.2.0,SyncBroadcast/5.1.1-SNAPSHOT,WSGroup/5.2.3-SNAPSHOT,WSGroup/5.1.2-SNAPSHOT,WSGroup/5.0.7-SNAPSHOT,JavaNode/5.2.3-SNAPSHOT,JavaNode/5.1 .0,JavaNode/5.0.7-SNAPSHOT,JavaNode/5.1.1,JavaNode/5.1.2,JavaNode/5.1.3,JavaNode/5.2.1-SNAPSHOT,SyncBroadcast/5.2.2-SNAPSHOT,WSGroup/0.1.0,WSGroup/5.0.3,WSGroup/5.2.1,SyncBroadcast/5.2.3,SyncBroadcast /5.0.5,WSGroup/5.2.2,WSGroup/5.0.4,WSGroup/5.0.3-SNAPSHOT,SyncBroadcast/5.2.2,SyncBroadcast/5.0.4,WSGroup/5.0.5,WSGroup/5.2.3,SyncBroadcast/5.0.7,WSGroup/5.0.6,WSGroup/5.2.4,SyncBroadcast/5.0.6,SyncBr oadcast/5.2.4,WSGroup/5.1.1-SNAPSHOT,SyncBroadcast/5.2.5-SNAPSHOT,WSGroup/5.2.0,JavaNode/5.0.8-SNAPSHOT,JavaNode/5.2.4-SNAPSHOT,WSGroup/5.2.5-SNAPSHOT,WSGroup/5.1.4-SNAPSHOT,SyncBroadcast/5.1.0,JavaNo de/5.0.5-SNAPSHOT,SyncBroadcast/5.1.2,SyncBroadcast/5.1.1,SyncBroadcast/5.1.4-SNAPSHOT,SyncBroadcast/5.0.3-SNAPSHOT,WSGroup/5.0.4-SNAPSHOT,JavaNode/5.0.4-SNAPSHOT,SyncBroadcast/5.0.8-SNAPSHOT,SyncBroa dcast/5.2.4-SNAPSHOT) 00:07 WARN: Try to select snapshot in best effort mode for com.softwareag.research.heads.tutorial.MoveMessage 00:07 WARN: Founded: MoveMessage:1.0.0-SNAPSHOT 00:07 WARN: Try to select snapshot in best effort mode for com.softwareag.research.heads.tutorial.MoveMessage 00:07 WARN: Founded: MoveMessage:1.0.0-SNAPSHOT 00:07 WARN: Try to select snapshot in best effort mode for com.softwareag.research.heads.tutorial.MoveMessage 00:07 WARN: Founded: MoveMessage:1.0.0-SNAPSHOT 00:07 INFO: Resolving ............. /packages[org]/packages[kevoree]/packages[library]/packages[java]/deployUnits[hashcode=,name=org.kevoree.library.java.javaNode,version=5.2.4] 00:07 INFO: Resolved in 0ms 00:07 INFO: JavaNode, changing LOG level to INFO 00:07 INFO: Starting node type of node0 00:08 INFO: Resolving ............. /packages[org]/packages[kevoree]/packages[library]/packages[java]/deployUnits[hashcode=,name=org.kevoree.library.java.channels,version=5.2.4] 00:08 INFO: Resolved in 0ms 00:08 INFO: Resolving ............. /packages[org]/packages[kevoree]/packages[library]/packages[java]/deployUnits[hashcode=,name=org.kevoree.library.java.ws,version=5.2.4] 00:08 INFO: Resolved in 0ms 00:08 INFO: Resolving ............. /packages[io]/packages[undertow]/deployUnits[hashcode=,name=undertow-core,version=1.2.0.Beta8] 00:08 INFO: Resolved in 10ms 00:08 INFO: Resolving ............. /packages[org]/packages[jboss]/packages[xnio]/deployUnits[hashcode=,name=xnio-nio,version=3.3.0.Final] 00:08 INFO: Resolved in 0ms 00:08 INFO: Resolving ............. /packages[org]/packages[jboss]/packages[xnio]/deployUnits[hashcode=,name=xnio-api,version=3.3.0.Final] 00:08 INFO: Resolved in 10ms 00:09 INFO: Resolving ............. /packages[org]/packages[jboss]/packages[logging]/deployUnits[hashcode=,name=jboss-logging,version=3.1.4.GA] 00:09 INFO: Resolved in 10ms 00:09 INFO: Resolving ............. /packages[fr]/packages[braindead]/deployUnits[hashcode=,name=wsmsgbroker-client,version=1.0.2] 00:09 INFO: Resolved in 0ms 00:09 INFO: Resolving ............. /packages[com]/packages[google]/packages[code]/packages[gson]/deployUnits[hashcode=,name=gson,version=2.3] 00:09 INFO: Resolved in 0ms 00:09 INFO: Resolving ............. /packages[org]/packages[java-websocket]/deployUnits[hashcode=,name=Java-WebSocket,version=1.3.0] 00:09 INFO: Resolved in 0ms 00:09 INFO: Add instance /nodes[node0]/components[myComp] 00:09 INFO: Add instance /groups[sync] 00:09 INFO: Add instance /hubs[chan2] 00:09 INFO: Add instance /hubs[chan0] 00:09 INFO: Bind /nodes[node0]/components[myComp]/provided[inQueue] /hubs[chan2] 00:09 INFO: Bind /nodes[node0]/components[myComp]/required[outQueue] /hubs[chan0] 00:09 INFO: Starting /nodes[node0]/components[myComp] 00:09 INFO: Start with node Id A, myComp, node0 00:09 INFO: Starting /groups[sync] Feb 16, 2015 1:40:23 PM org.xnio.Xnio INFO: XNIO version 3.3.0.Final Feb 16, 2015 1:40:23 PM org.xnio.nio.NioXnio INFO: XNIO NIO Implementation Version 3.3.0.Final 00:19 INFO: WSGroup "sync" listen on 9000 00:19 INFO: Starting /hubs[chan2] 00:19 INFO: Starting /hubs[chan0] 00:19 INFO: JavaNode Update completed in 11172 ms 00:19 INFO: End deploy result=true-11172 00:19 INFO: Bootstrap completed 01:11 INFO: Stopping Kevoree 01:11 INFO: Stopping /nodes[node0]/components[myComp] 01:11 INFO: Stop node A 01:11 INFO: Stopping /groups[sync] 01:11 INFO: Stopping /hubs[chan2] 01:11 INFO: Stopping /hubs[chan0] 01:11 INFO: Stopping node type of node0 01:11 INFO: Kevoree core stopped 01:11 INFO: Stopped.

maxleiko commented 9 years ago

Yes this is true, only node0 is started.

maxleiko commented 9 years ago

Kevoree won't start the other 2 nodes automatically. This is the architect role.

The easiest way to start the other 2 nodes is to execute those commands:

mvn kev:run -Dnode.name=node1
mvn kev:run -Dnode.name=node2
skorsky commented 9 years ago

This helps to start node1 and node2. But still I can't see messages sending form one node to the other.

maxleiko commented 9 years ago

You are using the SyncBroadcast channel. This channel can only dispatch messages locally (e.g on the same node)
Your use case involves multiple nodes, that's why no messages are being sent.

For "remote" communications, you can use the WSChan

Note that this WSChan type does not provide any server endpoint. So you have to run your own WSMsgBroker server

To run a WSMsgBroker, the easiest way is to run those commands:

npm i -g wsmsgbroker
wsbrokerserver 9050

This will, first, install the wsmsgbroker Node.js module globally on your machine, so that you can have access to the command-line executable wsbrokerserver (this is a one-time command, you will always have access to the executable once done) Then you start a new WSMsgBroker server with the second command (using port 9050)

By doing so, you will have a proper server endpoint, reachable by any WSChan instance you want to use at 0.0.0.0:9050

skorsky commented 9 years ago

This helps. Messages are exchanged by the nodes. But only for a short time.Then broker exits with: WSMsgBroker server listening on 0.0.0.0:9050/

events.js:72 throw er; // Unhandled 'error' event ^ Error: unable to parse message (only JSON-encoded messages are handled) at Server._messageHandler (D:\Users\mask\AppData\Roaming\npm\node_modules\wsmsgbroker\lib\Server.js:87:32) at Server. (D:\Users\mask\AppData\Roaming\npm\node_modules\wsmsgbroker\lib\Server.js:51:14) at WebSocket.emit (events.js:98:17) at Receiver.self._receiver.ontext (D:\Users\mask\AppData\Roaming\npm\node_modules\wsmsgbroker\node_modules\ws\lib\WebSocket.js:682:10) at Receiver.opcodes.1.finish (D:\Users\mask\AppData\Roaming\npm\node_modules\wsmsgbroker\node_modules\ws\lib\Receiver.js:391:14) at Receiver.expectHandler (D:\Users\mask\AppData\Roaming\npm\node_modules\wsmsgbroker\node_modules\ws\lib\Receiver.js:372:33) at Receiver.add (D:\Users\mask\AppData\Roaming\npm\node_modules\wsmsgbroker\node_modules\ws\lib\Receiver.js:87:24) at Socket.firstHandler (D:\Users\mask\AppData\Roaming\npm\node_modules\wsmsgbroker\node_modules\ws\lib\WebSocket.js:663:22) at Socket.emit (events.js:95:17) at Socket. (_stream_readable.js:765:14)

Logs for the nodes[0|1|2] are in git pull request.

maxleiko commented 9 years ago

Ok, so the WsMsgBroker was handling empty strings badly
But once you get the latest version of the broker, you will get a StackOverflow error that I cannot reproduce (without Kevoree, just using the Client/Server).
The exception is triggered by the Gson serializer, I'll dig into it this afternoon

maxleiko commented 9 years ago

Looks like a problem of the java_websocket library (again, this is why I've rewritten the WSGroup to use undertow's WebSocket lib instead of TooTallNate's java_websocket one).
I'll keep you up to date once fixed

skorsky commented 9 years ago

How to update WSMsgBroker? How can I see which version / build of WSMsgBroker is running?

maxleiko commented 9 years ago

Have a look at its package.json file. The version field is what you want. It is located with your globally installed npm module if you use the client version. Otherwise it will take the version specified by the Kevoree component (if you use it with kevoree-js)

skorsky commented 9 years ago

Is WsMsgBroker automatically updated when I run npm install? Now I have version 1.6.6 according to package.json.

maxleiko commented 9 years ago

Run npm install where ?

maxleiko commented 9 years ago

@skorsky I have made a bunch of fixes. Your example is now running using the latest releases v5.2.5

skorsky commented 9 years ago

I run npm install in the folder of the project.

Are the fixes in version 5.2.5 of org.kevoree.api?

maxleiko commented 9 years ago

The issues were on the standard libraries not Kevoree Core, you don't have to modify your kevoree.version in the pom.xml. Just re-run using mvn kev:run without any specified version for your TypeDefinitions

skorsky commented 9 years ago

works now.

Thanks for help.