You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by j_pramanik_ind <ja...@gmail.com> on 2016/07/30 18:17:37 UTC
Need to resolve the JavaDSL problem
Hi,
I'm new in Apache Camel. I'm using Camel 2.14.2. Here is a typical problem
that I'm facing while using Apache Camel in one of my project -
There are currently four layers :
UI layer, Channel Manager Layer, Camel EIP Layer with JavaDSL & CoreApp
Layer.
1. UI will initiate rest call to Channel Manager layer.
2. ChannelManager delegates call to EIP layer.
3. Camel EIP layer take a decision on the basis of the call
For e.g. - if the REST call is like below -
*https://localhost:8643/CamelRouterApp/service/proxyService/checkOperation/actionLevel=LOCAL|activityCode=LOGIN|method=AuthenticateUser*
Using JavaDSL it invokes RouteBuilder -
public String start(String moduleName, String authcode, String
operationvalues){
try{
CamelContext context = new DefaultCamelContext();
context.addRoutes(new IntegrationRoute(moduleName, authcode,
operationvalues));
context.start();
Thread.sleep(1000); /// need to make wait the thread for 1000 ms
Map<String, String> map = context.getProperties();
data = map.get("1");
context.stop();
}catch(Exception ex1){
ex1.printStackTrace();
}
return data;
}
it returns as below -
* <PROXYOPERATIONS>
<oprnvalue>LOCAL</oprnvalue>
</PROXYOPERATIONS>*
I used following code to take decision -
public void configure() throws Exception {
from(proxyURL)
.choice()
.when(xpath("//oprnvalue = 'LOCAL'"))
.process(new
RESTRequestProcessor(authcode,operationvalues))
.when(xpath("//oprnvalue = 'REMOTE'"))
.process(new
RESTRequestProcessor(authcode,operationvalues))
.otherwise()
.log("NO VALID CALL !!");
}
4. Accordingly it invokes processor that returns through Exchange
properties.
public void process(Exchange data) throws Exception {
. . .
. . . . . [call to inner CoreApp layer and return data]
Map<String, String> map = new HashMap<String, String>();
map.put("1",result);
data.getContext().setProperties(map);
}
*PROBLEM is here some times data return is taking little bit more time and
Camel returns null.
Repeated try from front-end makes Camel to fetch some data.
*
/This is only due to slowness of my CoreApp inner layer processing. But I
can not change that immediately. Rather I'm looking for different solution
with Camel. Can I use REST DSL to directly call inner layer RESTful service
? And of course the decision making part should be there LOCAL or REMOTE or
BOTH. /
Can anybody please enlight on this problem or guide me what to do and how
with Apache Camel 2.14 ?
Thanks in advance.
Regards,
Jay
--
View this message in context: http://camel.465427.n5.nabble.com/Need-to-resolve-the-JavaDSL-problem-tp5785709.html
Sent from the Camel Development mailing list archive at Nabble.com.