req.endHandler(function() { requests[key] = body; log('Request: Received ' + key + ' with "' + body.toString() + '"'); if (registry[key] != undefined) { log('Request response found: ' + key + ' returned "' + registry[key] + '"'); req.response.end(registry[key]); return; } req.response.end(); log('Request: ' + key + ' not in registry. Nothing returned.'); }); } log('config is ' + JSON.stringify(config)); var registry = {}; var requests = {}; var server = vertx.createHttpServer(); server.requestHandler(function(req) { var path = new java.lang.String(req.path()); if (path.startsWith('/~')) { log('Init registration...'); handleRegistration(req); } else if (path.startsWith('/_')) { handleVerification(req); } else { handleRequest(req); } }).listen(config.port, 'localhost');
eb.send('test.persistor', { action: 'insert', stmt: 'INSERT INTO messages( name, message ) VALUES( ?, ? )', values: [ p.name, p.text ] }, function (reply) { index( r ) ; }); } else { console.log( 'Skipped... no data' ) ; index( r ) ; } } )( req ) ; }); vertx.createHttpServer().requestHandler( rm ).listen( 8080 ) ; var mysqlPersistorConf = { address : "test.persistor", // JDBC connection settings driver : "com.mysql.jdbc.Driver", url : "jdbc:mysql://localhost:3306/vertx", username : "******", password : "******", } vertx.deployModule( 'com.bloidonia.jdbc-persistor-v1.0', mysqlPersistorConf, 1, function( reply ) { console.log( 'connected' ) ; });