All,
I'm trying to execute a few steps using Camel-Mina TCP component in
servicemix:
- get InOut message from ServiceMix component
- process message (processed message is still an XML)
- send it to TCP server (via Mina)
- get response from TCP server (response is an XML)
- process response and send it back to ServiceMix component
Here is my code:
public class TcpRouteBuilder extends RouteBuilder {
public void configure() throws Exception {
String fullAddress = new StringBuilder()
.append("mina:tcp://")
.append(serverAddress)
.append(":")
.append(serverPort)
.append("?textline=true&sync=true&transferExchange=true").toString();
from("jbi:endpoint:http://namespace/tcpService/tcpEndpoint").process(
new Processor() {
public void process(Exchange exchange) throws Exception
{
String xmlString = convertToString((DOMSource)
exchange.getIn().getBody());
xmlString = prepareMessage(xmlString);
exchange.getIn().setBody(xmlString);
}
}
).to(fullAddress).process(
new Processor() {
public void process(Exchange exchange) throws Exception
{
// here some additional processing of response is
required but body seems to be null
Object body = exchange.getOut().getBody();
body = processBody( body );
exchange.getOut().setBody(body);
}
}
);
}
}
In the second processor I get null from exchange.getOut().getBody().
What am I doing wrong? How should I get valid XML response from TCP and
process it somehow?
Could you please advice something?
I'm using FuseESB 3.3.1.11 with Camel 1.5.0 (camel-core-1.5.0.0-fuse.jar and
camel-mina-1.5.0.jar) and Mina 1.1.7 (mina-core-1.1.7.jar).
Thanks in advance for your help.
--
View this message in context:
http://www.nabble.com/camel-mina-in-servicemix---how-to-process-TCP-response--tp20794416s22882p20794416.html
Sent from the Camel - Users mailing list archive at Nabble.com.