FAQ
Hi,
I have 3 camel flows and i have used my custom processor to change in
message body.
here are my 3 flows and 3 custom Processors-

*camel flow 1:*
from("activemq:queue:*startQ*")
.process(// *Custom Processor 1*//)
.split(body().tokenize(";")).streaming()
.delay(9000)
.choice()
.when(xpath("//inputs/deliveryProperty/inputType = 'File'"))
.to("activemq:queue:*fileQ*")
.when(xpath("//inputs/deliveryProperty/inputType = 'MQ'"))
.to("activemq:queue:*mqQ*")
.otherwise()
.to("activemq:queue:*tempQ*");

*Custom Processor 1:*
public void process(Exchange exchange) throws Exception {
String *newBody *= "";
Message in = exchange.getIn();
if (in != null) {
try {
//calling my custom method for processing input from xml
List<String> configStrList = processConfig((ConfigurationInputType.XML));
for (int i = 0; i < configStrList.size(); i++) {
//modify new body, to enable this for querying (xpath)
*newBody *= newBody+configStrList.get(i);
if (i<configStrList.size()-1) {
&lt;b>newBody *= newBody+";";
}
}
} catch (Exception e) {
throw e;
}
}
*exchange.getIn().setBody(newBody);*
}

*Camel flow 2:*
from("activemq:queue:*fileQ*")
.setHeader("folderName",
xpath("//inputs/deliveryProperty/folderName").stringResult())
.setHeader("fileName",
xpath("//inputs/deliveryProperty/fileName").stringResult())
.setHeader("sourceSystem",
xpath("//inputs/deliveryProperty/sourceSystem").stringResult())
.process(// *Custom Processor 2*//)
.to("activemq:queue:*identificationQ*");

*Custom Processor 2:*
@Override
public void process(Exchange exchange) throws Exception {
String *newBody *= "";
Message in = exchange.getIn();
if (in!= null) {
String folderName = in.getHeader("folderName").toString();
String fileName = in.getHeader("fileName").toString();
String sourceSystem = in.getHeader("sourceSystem").toString(); *newBody
*= processInput(folderName, fileName, sourceSystem);//call my custom method
to get updated string for message body
}
*exchange.getIn().setBody(newBody);*
}

*camel flow 3:*
from("activemq:queue:*identificationQ*")
.process(// *Custom Processor 3*//)
.to("activemq:queue:*routingQ*");

*Custom Processor 3:*
@Override
public void process(Exchange exchange) throws Exception {
Message in = exchange.getIn();
String *updatedBodyStr *= "";
if (in != null) {
String inputXmlStr = in.getBody(String.class);
*updatedBodyStr *=
processInputMsg(ConfigurationInputType.XML, inputXmlStr);// my custom method
to get updated string for message body

}
*exchange.getIn().setBody(updatedBodyStr);*
}


1st 2 flows working properly, means- i get updated srint message body inthe
end queue.
but i faced problem for the 3rd flw. it cannt working at all. no exception
i'm getting. but when i'm reading the end Queue for the 3rd flow
(*routingQ*) i just getting the same thing as in source queue for the 3rd
flow i.e. *identificationQ*.

i have tested with
*"System.out.println(exchange.getIn().getBody(String.class));"* after
setting the message in the exchange. i showed the updated one but when i
read from the queue i wont.

i have also tried with *" if (exchange.getPattern().isOutCapable()) {
exchange.getOut().setBody(updatedBodyStr);
} else {
exchange.getIn().setBody(updatedBodyStr);
}"*. again i got the same thing.

i have just messed up.
Please help me.

And sorry for advance, if this kind of post already posted here. I'm posting
it after searching..but i cann't get any thing relevent with my problem.
Sorry.

Anindita

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedApr 12, '12 at 7:37a
activeApr 12, '12 at 7:37a
posts1
users1
websitecamel.apache.org

1 user in discussion

Anindita: 1 post

People

Translate

site design / logo © 2021 Grokbase