|
@ -0,0 +1,27 @@
|
|
|
package camel.gatewaylog.route;
|
|
|
|
|
|
import camel.gatewaylog.processor.LogProcesser;
|
|
|
import org.apache.activemq.ActiveMQConnectionFactory;
|
|
|
import org.apache.camel.builder.RouteBuilder;
|
|
|
import org.apache.camel.component.jms.JmsComponent;
|
|
|
import org.apache.camel.model.ModelCamelContext;
|
|
|
|
|
|
import javax.jms.ConnectionFactory;
|
|
|
|
|
|
/**
|
|
|
* @author Airhead
|
|
|
* @since 2017/3/30.
|
|
|
*/
|
|
|
public class LogRouterBuilder extends RouteBuilder {
|
|
|
@Override
|
|
|
public void configure() throws Exception {
|
|
|
ModelCamelContext context = this.getContext();
|
|
|
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
|
|
|
"admin", "admin", "tcp://172.19.103.57:61616");
|
|
|
// Note we can explicit name the component
|
|
|
context.addComponent("business-log-2", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
|
|
|
from("business-log-2:topic:business.log.queue")
|
|
|
.process(new LogProcesser())
|
|
|
.to("file://e:/log");
|
|
|
}
|
|
|
}
|