我想要一個Apache Camel Servlet立即返回的請求,但在「後臺」線程中繼續處理請求。我已經嘗試了幾件事情,但它似乎在返回之前仍然處理很多。如何使Apache Camel Servlet請求立即返回?
from("servlet://my-endpoint")
.threads()
.process(exchange -> {
exchange.getOut().setBody(doStuff(exchange.getHeaders()))
})
.multicast()
.parallelProcessing()
.recipientList(constant("direct:a,direct:b,direct:c"), ",")
.ignoreInvalidEndpoints()
.transform()
.constant("OK");
我測試使用curl:
curl 'http://localhost:4000/my-app/camel/my-endpoint' -X POST --data 'myVar=bar&myOtherVar=foo'
任何想法我做錯了嗎?