骆驼和 ActiveMQ
Camel and ActiveMQ
我对骆驼世界很陌生,这就是我寻求您帮助的原因。
让我告诉你我想做什么:
我有这个基本的 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
只做一条从 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 书籍
我对骆驼世界很陌生,这就是我寻求您帮助的原因。 让我告诉你我想做什么: 我有这个基本的 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
只做一条从 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 书籍