我对骆驼世界很新,这就是为什么我要求你的帮助。 让我告诉你我想做什么: 我有这个基本的Camel独立项目:
package maventest1;
public class JmsToSql {
private Main main;
public static void main(String[] args) throws Exception {
JmsToSql example = new JmsToSql();
example.boot();
}
public void boot() throws Exception {
main = new Main();
main.enableHangupSupport();
main.bind("foo", new MyBean());
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
main.bind("test-jms",JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
main.addRouteBuilder(new MyRouteBuilder());
main.run();
}
private static class MyRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from("timer:foo?delay=2000")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
//NOT SURE THIS IS THE RIGHT WAY
from("test-jms:queue:order1")
.to("test-jms:queue:order2");
}
})
.beanRef("foo");
}
}
public static class MyBean {
public void callMe() {
System.out.println("MyBean.calleMe method has been called");
}
}
}
我想要做的就是从activeMQ队列中读取所有消息并将它们传递到另一个队列。有人知道我怎么做吗? 在此先感谢= D
答案 0 :(得分:1)
只需从JMS到JMS的路线
private static class MyRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from("test-jms:queue:order1")
.to("test-jms:queue:order2");
}
由于您是Camel的新手,我建议您先阅读本文
如果您想获得精彩的文档和教程,请选择一本Camel书籍