2016-08-29 29 views
1

在以下示例中(取自Akka Camel doc),Jetty HTTP組件用於接收HTTP消息。這是否意味着演員啓動了一個新的Jetty服務器?駱駝碼頭組件如何在阿卡工作?

import akka.camel.{ CamelMessage, Consumer } 

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

    def receive = { 
    case msg: CamelMessage => { /* ... */ } 
    case _     => { /* ... */ } 
    } 
} 

回答

1

正確,jetty消費將啓動嵌入式Jetty服務器,並將其綁定到指定的端口。

下面是引自the official documentation

該碼頭組件提供基於HTTP的端點消費國和生產的HTTP請求。 也就是說,Jetty組件的行爲與簡單的Web服務器相同。

+0

謝謝。如果我有多個Jetty端點會發生什麼?它會啓動多個Jetty服務器嗎?試圖評估使用駱駝碼頭HTTP與Akka-html – EugeneMi

+0

它應該只啓動一臺服務器,看看這個鏈接:http://camel.465427.n5.nabble.com/Using-a-single-port-for -all-Jetty-Consumers-td5736267.html –

+0

或者,更好的是,[Jetty組件的代碼](https://github.com/apache/camel/blob/e4b2c99591f54f4d909e1e245b0c8d012c89a8c2/components/camel-jetty-common/src/main /java/org/apache/camel/component/jetty/JettyHttpComponent.java#L316),您可以在其中看到服務器僅針對不同的協議,主機名和端口組合啓動。 –