我刚刚发现了骆驼,这似乎正是我所需要的。
我有几个构建块,它们知道如何处理特定的输入数据,所以我想为用户创建一个非常简单的GUI,让用户选择构建块,然后一个接一个地将它们链接起来(有点像Fuse IDE,但不是那种花哨)。一个线性的组件列表对我来说就足够了)。
我无法找到示例,如何在其中一个一个地启动上下文提要简单的POJO,每次都要等到前面的输入消息到达它的路由的末尾,然后在相反的上获得另一个POJO。
或将其写入数据库/序列化到文件。
谷歌只提供了一些关于Spring,ActiveMQ等的例子。我只需要最简单的场景,但是找出使用哪个URI等等。
PS:我可以运行这个简单的例子(唯一的依赖项是camel-core 2.13和slf4j 1.7.7)
CamelContext context = new DefaultCamelContext();
// add our route to the CamelContext
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
from("file:src/data?noop=true").
choice().
when(xpath("/person/city = 'London'")).to("file:target/messages/uk").
otherwise().to("file:target/messages/others");
}
});
// start the route and let it do its work
System.out.println("Starting camel no maven");
context.start();
Thread.sleep(3000);
System.out.println("Done camel no maven");
// stop the CamelContext
context.stop();发布于 2014-05-08 00:17:54
看看CamelProxy。它允许您发送到Camel端点。
OrderService service = new ProxyBuilder(context)
.endpoint("direct:order")
.build(OrderService.class);OrderService是一个接口,它定义了要用来发送的方法:
public interface OrderService {
public String send(SomeBean message);
}样本路线:
from("direct:order").to("bean:someProcessor");向路线发送一条消息:
String reply = service.send(new SomeBean());https://stackoverflow.com/questions/23530027
复制相似问题