1

In the following example (taken from Akka Camel doc), the Jetty HTTP component is used to receive HTTP messages. Does it mean that the actor start a new Jetty server?

import akka.camel.{ CamelMessage, Consumer }

class MyEndpoint extends Consumer {
  def endpointUri = "jetty:http://localhost:8877/example"

  def receive = {
    case msg: CamelMessage => { /* ... */ }
    case _                 => { /* ... */ }
  }
}
Miloš Milivojević
  • 5,219
  • 3
  • 26
  • 39
EugeneMi
  • 3,475
  • 3
  • 38
  • 57

1 Answers1

1

Correct, jetty consumer will start an embedded Jetty server and bind it to the specified port.

Here's a quote from the official documentation:

The jetty component provides HTTP-based endpoints for consuming and producing HTTP requests. That is, the Jetty component behaves as a simple Web server.

Miloš Milivojević
  • 5,219
  • 3
  • 26
  • 39
  • Thanks. What happens if I have multiple Jetty end points? Will it start multiple Jetty servers? Trying to evaluate using Camel Jetty HTTP vs Akka-html – EugeneMi Aug 31 '16 at 19:02
  • It should start only a single server, take a look at this link: http://camel.465427.n5.nabble.com/Using-a-single-port-for-all-Jetty-Consumers-td5736267.html – Miloš Milivojević Aug 31 '16 at 19:18
  • Or, better yet, [code for Jetty component](https://github.com/apache/camel/blob/e4b2c99591f54f4d909e1e245b0c8d012c89a8c2/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java#L316), where you can see that the server is only started for different protocol, hostname and port combinations. – Miloš Milivojević Aug 31 '16 at 19:57