Permalink
Browse files

Workers sample updated

  • Loading branch information...
1 parent b9fff61 commit 2bcf37e3b416dbd24e03352e5d5e791c644c0208 @ajlopez committed Jan 26, 2013
Showing with 17 additions and 17 deletions.
  1. +6 −3 samples/Workers/README.md
  2. +5 −0 samples/Workers/server.js
  3. +6 −14 samples/Workers/stormapp.js
@@ -19,12 +19,15 @@ Example
```
node server.js http://ajlopez.wordpress.com
```
+Server exposes a queue server using port 3000. It listens to topology workers at port 3001.
+
Launch one or more clients
```
-node stormnode.js port [host:port ...]
+node stormnode.js port
```
-The node starts to listen other nodes at `port`. The optional additional addresses refers to already running
-nodes.
+The node starts to listen other nodes at `port`. It communicates its address to the topology server
+listening at port 3001.
+
@@ -69,6 +69,11 @@ var server = sq.createRemoteServer(queueserver);
server.listen(3000);
+// Topology server
+
+var tserver = ss.createTopologyServer();
+tserver.listen(3001);
+
// Objects
var resolver = new Resolver(resolverqueue, linksqueue);
@@ -2,8 +2,7 @@
var ss = require('../../'),
sq = require('simplequeue'),
http = require('http'),
- url = require('url'),
- sm = require('simplemessages');
+ url = require('url');
var hostnames = {};
@@ -161,20 +160,13 @@ qclient.on('remote', function(remote) {
builder.setBolt("resolver", resolver).shuffleGrouping("harvester");
var topology = builder.createTopology();
-
- topology.start();
-
- var server = sm.createServer(function (channel) {
- topology.registerWorker(channel, channel);
- });
- server.listen(port);
+ topology.connectToServer(3001);
- nodes.forEach(function (node) {
- var client = sm.createClient(node.port, node.host, function() {
- topology.registerWorker(client, client);
- });
- });
+ if (port)
+ topology.listen(port);
+
+ topology.start();
});
});
});

0 comments on commit 2bcf37e

Please sign in to comment.