Not able to receive file at Http producer(tomcat server)
- I am starting now with Camel. I am trying to create route as to process file from a file component and pass on to a http tomcat server.
- I have created the route as follows
from("file:inbox?noop=false").to("http://localhost:8080/myServer/");
I have also tried using my I.P address in place of localhost
- I am not getting any compilation error nor at runtime and the file is getting processed from inbox folder, but I am not able to receive the file in myServer directory.
- Camel versio开发者_开发百科n I am using is 2.0.0 .
yep, this should work...you should use the latest version of Camel though (2.8.2 currently)...here is a simple unit test to show the FILE->HTTP in action...
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
public class FileToHttpRouterTest extends CamelTestSupport {
@Test
public void test() throws Exception {
Thread.sleep(1000);
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("timer://foo?fixedRate=true&period=200")
.setBody(simple("${exchangeId}"))
.to("file://tmp/inbox");
from("file://tmp/inbox")
.to("http://localhost:9000/myTest");
from("jetty:http://localhost:9000/myTest")
.log("received: ${body}");
};
};
}
}
精彩评论