123456789101112131415161718192021222324252627282930313233343536373839 |
- package camel.central.archives.route;
- import com.yihu.hos.web.framework.constant.ArchivesConstant;
- 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 org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Component;
- import javax.jms.ConnectionFactory;
- /**
- * 档案入库-消息接收服务
- * @author HZY
- * @vsrsion 1.0
- * Created at 2017/3/13.
- */
- @Component
- public class ArchivesMqRouter extends RouteBuilder {
- @Value("${spring.activemq.broker-url}")
- private String brokerURL;
- @Value("${spring.activemq.user}")
- private String user;
- @Value("${spring.activemq.password}")
- private String password;
- @Override
- public void configure() throws Exception {
- ModelCamelContext context = this.getContext();
- ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
- user, password, brokerURL);
- // Note we can explicit name the component
- context.addComponent(ArchivesConstant.CAMEL_COMPONENT, JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
- from(ArchivesConstant.CAMEL_ENDPOINT)
- .to("bean:archivesService?method=storageArchive");
- }
- }
|