假設我想利用Camel作爲RESTful Web服務的客戶端。但不確定駱駝是否足夠適合這種工作。我也想使用http4或ahc組件,而不是cxf。Can Camel可以用作純粹的RESTful web服務客戶端嗎?
總的來說,我只需要兩種途徑:
- 從豆 - >馬歇爾JSON - >到AHC靜態URI - >解組 從JSON - >到豆。靜態URI的示例:
ahc:http://host/api/user/create
- 從Bean - > marshall到Json - > to Ahc with dynamic URI - > unmarshall from Json - > to Bean。動態URI的示例:
ahc:http://host/api/user/id/1
我想象有一個服務類火災的方式像這樣的路線:
UserService {
@Autowired
protected CamelContext restApiCamelContext;
public UserCreateResponse createUser (UserModel user) {
... Camel's magick which starts create user route ...
}
public UserModel getUserById (Long id) {
... the id must be placed somehow into endpoint uri: http://host:port/api/user/id/${id} ...
... Camel's magick which get user by id ...
}
}
的UserService假定在Spring MVC控制器中使用。
那麼,是否有可能實現基於駱駝功能的這樣的UserService?如果是的話,那麼它會在用戶要求春季控制器的大量用戶請求的高壓下運行嗎?它可以在近百個不同的uris中正常工作嗎?