package zero.down.time.soa.api;

import org.apache.camel.builder.RouteBuilder;

/**
 * @author magonzal
 * @version 1.0.0
 */
public class HelloServiceApi extends RouteBuilder {

	@Override
	public void configure() throws Exception {
		//@formatter:off
		restConfiguration().component("jetty")
			.host("localhost")
			.port(8080)
			.contextPath("hello-service-api/rest");

		rest("/{user}").description("Say hello to User")
			.get().route().to("direct-vm:hello");
		//@formatter:on
	}
}


@@ -71,16 +71,56 @@
 Builder;
+%0Aimport org.eclipse.jetty.server.Server;
 %0A%0A/**%0A *
@@ -267,16 +267,17 @@
 ption %7B%0A
+%0A
 %09%09//@for
@@ -363,12 +363,29 @@
 ort(
-8080
+getRandomServerPort()
 )%0A%09%09
@@ -518,16 +518,16 @@
 ello%22);%0A
-
 %09%09//@for
@@ -538,12 +538,172 @@
 er:on%0A%09%7D
+%0A%0A%09private int getRandomServerPort() throws Exception %7B%0A%09%09Server server = new Server(0);%0A%09%09server.start();%0A%09%09return server.getConnectors()%5B0%5D.getLocalPort();%0A%09%7D
 %0A%7D%0A%0A

Use random port to start Jetty