import org.vertx.java.core.{AsyncResult, VertxFactory, Handler, Vertx}import org.vertx.java.core.http.{HttpServer, HttpServerResponse, HttpServerRequest}
object Main extends App { val server = VertxFactory.newVertx().createHttpServer().requestHandler(handler) server.listen(88, "localhost", new Handler[AsyncResult[HttpServer]] { def handle(res: AsyncResult[HttpServer]) { res.succeeded() match { case true => println("Server was binded to port 88.") case false => res.cause().printStackTrace() } } })
System.in.read()
def handler = new Handler[HttpServerRequest] { def handle(req: HttpServerRequest) { println("REQ %s: %s (server ID=%s)".format(req.method(), req.uri(), this.##)) req.response().setStatusCode(200) req.response().end() } }}Can you provide a runnable test case that demonstrates the issue (not in
Scala please)?
Vert.x allows you to bind multiple servers in the same Vert.x instance to the same host/port - under the bonnet only one server is created and requests are round robin'd between them. This is explained in the API manual.
--
You received this message because you are subscribed to a topic in the Google Groups "vert.x" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vertx/I6qdw8GXVoQ/unsubscribe.
To unsubscribe from this group and all of its topics, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Thanks, Tim! If I understand you correctly, you said that multiple HttpServers in the same vertx instance can be bound to the same port/host. But in my test I actually create two different non-clustered vert.x instances (according to javadocs) with this call:VertxFactory.newVertx()
Am I missing something or don't understand? Is it correct that that two HttpServers in different vertx instances can be bound to the same port/host? If so, how can I disable such load balancing behaviour?