java - 部署 Apache Camel 项目

标签 java maven deployment apache-camel

我使用 spring 配置创建了一个 Camel 项目,现在我需要在我的生产环境中部署和运行它。基本上,它是一个监听 RabbitMQ 代理的进程,并在发送消息时对其进行处理。我正在使用 eclipse,我为此目标创建了一个调试/运行配置:

camel:run

使用Spring配置文件定义route和bean,我没有写主类,如何部署运行呢?我无法在生产环境中重新编译该项目,因为我无法安装新软件,因此,运行我的流程所需的一切都必须从我的开发环境中复制。

有什么提示吗?谢谢!

最佳答案

http://camel.apache.org/running-camel-standalone.html

http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html

描述允许您部署/运行的机制。

camel:run 本质上与创建加载 Spring 应用程序上下文的 org.apache.camel.spring.Main 类相同。它可以很简单:

public static void main( final String[] args) {

    Main main = new Main();
    main.setApplicationContextUri("classpath:META-INF/applicationContext.xml");
    main.enableHangupSupport();

    try {
        main.run();
    } ...
}

这与 camel:run 目标基本相同。

为了正确部署,您可能需要使用 maven assembly pluginmaven shade plugin .这将允许您创建一个可以部署的 Artifact (zip、jar 等)。相同的代码,相同的路由定义。

关于java - 部署 Apache Camel 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14814693/

相关文章:

java - 未绑定(bind)的类路径变量

java - 如何像在Eclipse中一样在Intellij中的jetty上运行maven项目?

java - 部署期间与开发期间从 JAR 文件加载

css - Angular2 部署 - 如何自动修改 index.html 中对 styles.bundle.css 的引用

java - struts2.3.12中servletactioncontext为空

Java 逻辑 AND 与 IF

java - 空列表和空列表有什么区别?

spring - 无法实例化 bean : Constructor threw exception; nested exception is java. lang.NullPointerException

android - 如何在 Eclipse Indigo 中禁用 m2e 构建?

visual-studio-2008 - 包含文件夹中所有文件的 Visual Studio 安装项目