Red Hat Fuse Quickstart 应用程序 "Content Based Router - Java DSL" 未创建 "work" 文件夹
Red Hat Fuse Quickstart app "Content Based Router - Java DSL" does not create "work" folder
问题
Red Hat Fuse Quickstart 应用程序“基于内容的路由器 - Java DSL”模板不起作用。即,在构建 运行 和部署(到 "Red Hat Fuse 7.1")时,永远不会创建 "work" 文件夹。
这里是 Java 代码:
package com.mycompany.camel;
import org.apache.camel.builder.RouteBuilder;
public class CamelRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("file:work/cbr/input") //<== "work" folder not created...
.log("Receiving order ${file:name}")
.choice()
.when().xpath("//order/customer/country[text() = 'UK']")
.log("Sending order ${file:name} to the UK")
.to("file:work/cbr/output/uk")
.when().xpath("//order/customer/country[text() = 'US']")
.log("Sending order ${file:name} to the US")
.to("file:work/cbr/output/us")
.otherwise()
.log("Sending order ${file:name} to another country")
.to("file:work/cbr/output/others")
.log("Done processing ${file:name}");
}
}
请注意,“基于内容的路由器 - 蓝图 DSL”确实工作(即,它使用 blueprint.xml 文件来定义路线,而不是 Java 代码)。
我正在使用 "Red Hat Developer Studio" 中的 "quickstart" 模板。
即File-->New-->Fuse Integration Project-->[create project name]-->选择"Standalone"平台,选择"Karaf/Fuse on Karaf"-->在"Beginner"下选择"Content Based Router - Java DSL" --> 完成 --> 等等
已构建并热部署。 Java DSL 快速启动项目启动并 运行s - 但是,它没有创建父 "work" 文件夹(更不用说其他子文件夹)了。
模板项目 and/or 配置中可能缺少什么?
我想知道:Java DSL 是否会被 Spring DSL and/or 蓝图 DSL 所取代? (我曾将 Java DSL 与旧的 Jboss Fuse 6.3 一起使用并且喜欢它)。
值得一提的是pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>camel-java-cbr</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Fuse CBR Quickstart - Java</name>
<description>Camel Content-Based Router Example using the Java DSL</description>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<version.maven-bundle-plugin>3.2.0</version.maven-bundle-plugin>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jboss.fuse.bom.version>7.1.0.fuse-710023-redhat-00001</jboss.fuse.bom.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.fuse</groupId>
<artifactId>jboss-fuse-parent</artifactId>
<version>${jboss.fuse.bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
</dependencies>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>fuse-public-repository</id>
<name>FuseSource Community Release Repository</name>
<url>https://repo.fusesource.com/nexus/content/groups/public</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>red-hat-ga-repository</id>
<name>Red Hat GA Repository</name>
<url>https://maven.repository.redhat.com/ga</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>red-hat-ea-repository</id>
<name>Red Hat EA Repository</name>
<url>https://maven.repository.redhat.com/earlyaccess/all</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>jboss-ea-repository</id>
<name>Red Hat JBoss Early Access Repository</name>
<url>http://repository.jboss.org/nexus/content/groups/ea</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>fuse-public-repository</id>
<name>FuseSource Community Release Repository</name>
<url>https://repo.fusesource.com/nexus/content/groups/public</url>
</pluginRepository>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>red-hat-ga-repository</id>
<name>Red Hat GA Repository</name>
<url>https://maven.repository.redhat.com/ga</url>
</pluginRepository>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>red-hat-ea-repository</id>
<name>Red Hat EA Repository</name>
<url>https://maven.repository.redhat.com/earlyaccess/all</url>
</pluginRepository>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>jboss-ea-repository</id>
<name>Red Hat JBoss Early Access Repository</name>
<url>http://repository.jboss.org/nexus/content/groups/ea</url>
</pluginRepository>
</pluginRepositories>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${version.maven-bundle-plugin}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>myJavaDsl</Bundle-SymbolicName>
<Bundle-Name>Camel Content-Based Router Example using the Java DSL [myJavaDsl]</Bundle-Name></instructions></configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<mainClass>com.mycompany.camel.Launcher</mainClass>
<includePluginDependencies>false</includePluginDependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>
Red Hat Developer Studio,版本:12.9。0.GA
fuse-karaf-7.1.0.fuse-710023-redhat-00001
jdk1.8.0_121
C:\apache-maven-3.6.0
Using Quickstart projects are referred to in Red Hat Fuse Tooling User Guide - PDF
检查 C:\ 的文件夹权限并使用如下所述的 uri:
从("file://C:/AAAInput/?autoCreate=true&noop=true")
看起来你的路线根本没有开始。尝试使用直接引用来路由构建器而不是像这样的包扫描:
<camel:camelContext id="aaa.bbb.ccc.jar" xmlns="http://camel.apache.org/schema/blueprint">
<camel:routeBuilder ref="routeBuilder"/>
</camel:camelContext>
<bean id="routeBuilder" class="aaa.bbb.ccc.jar.CamelRoute" />
我执行了以下步骤以使其与 Fuse 运行时一起工作:
- 创建一个新的 Fuse 集成项目 - Standalone,Karaf / Fuse on Karaf,CBR - Java DSL
- 新建文件夹和文件“src/main/resources/OSGI-INF/blueprint/blueprint.xml
- blueprint.xml 文件内容:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<bean class="com.mycompany.camel.CamelRoute" id="myRouteBuilder"/>
<camelContext id="cbr-example-context" xmlns="http://camel.apache.org/schema/blueprint">
<routeBuilder ref="myRouteBuilder"/>
</camelContext>
</blueprint>
- 在 Red Hat Developer Studio
中通过 Servers 视图部署项目
因为该文件位于我们 JAR 中的 OSGI-INF/blueprint 目录中,所以它会在安装包后立即自动激活。这是可能的,因为 Red Hat Fuse 将 Apache Karaf 与 Blueprint 部署器结合使用 - 请参阅 Deploying into Apache Karaf - OSGi Services
无论如何,提供的模板应该开箱即用。因此,我向 Fuse Tooling 的开发人员提出了一个问题 - https://issues.jboss.org/browse/FUSETOOLS-3178
问题
Red Hat Fuse Quickstart 应用程序“基于内容的路由器 - Java DSL”模板不起作用。即,在构建 运行 和部署(到 "Red Hat Fuse 7.1")时,永远不会创建 "work" 文件夹。
这里是 Java 代码:
package com.mycompany.camel;
import org.apache.camel.builder.RouteBuilder;
public class CamelRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("file:work/cbr/input") //<== "work" folder not created...
.log("Receiving order ${file:name}")
.choice()
.when().xpath("//order/customer/country[text() = 'UK']")
.log("Sending order ${file:name} to the UK")
.to("file:work/cbr/output/uk")
.when().xpath("//order/customer/country[text() = 'US']")
.log("Sending order ${file:name} to the US")
.to("file:work/cbr/output/us")
.otherwise()
.log("Sending order ${file:name} to another country")
.to("file:work/cbr/output/others")
.log("Done processing ${file:name}");
}
}
请注意,“基于内容的路由器 - 蓝图 DSL”确实工作(即,它使用 blueprint.xml 文件来定义路线,而不是 Java 代码)。
我正在使用 "Red Hat Developer Studio" 中的 "quickstart" 模板。
即File-->New-->Fuse Integration Project-->[create project name]-->选择"Standalone"平台,选择"Karaf/Fuse on Karaf"-->在"Beginner"下选择"Content Based Router - Java DSL" --> 完成 --> 等等
已构建并热部署。 Java DSL 快速启动项目启动并 运行s - 但是,它没有创建父 "work" 文件夹(更不用说其他子文件夹)了。
模板项目 and/or 配置中可能缺少什么?
我想知道:Java DSL 是否会被 Spring DSL and/or 蓝图 DSL 所取代? (我曾将 Java DSL 与旧的 Jboss Fuse 6.3 一起使用并且喜欢它)。
值得一提的是pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>camel-java-cbr</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Fuse CBR Quickstart - Java</name>
<description>Camel Content-Based Router Example using the Java DSL</description>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<version.maven-bundle-plugin>3.2.0</version.maven-bundle-plugin>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jboss.fuse.bom.version>7.1.0.fuse-710023-redhat-00001</jboss.fuse.bom.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.fuse</groupId>
<artifactId>jboss-fuse-parent</artifactId>
<version>${jboss.fuse.bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
</dependencies>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>fuse-public-repository</id>
<name>FuseSource Community Release Repository</name>
<url>https://repo.fusesource.com/nexus/content/groups/public</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>red-hat-ga-repository</id>
<name>Red Hat GA Repository</name>
<url>https://maven.repository.redhat.com/ga</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>red-hat-ea-repository</id>
<name>Red Hat EA Repository</name>
<url>https://maven.repository.redhat.com/earlyaccess/all</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>jboss-ea-repository</id>
<name>Red Hat JBoss Early Access Repository</name>
<url>http://repository.jboss.org/nexus/content/groups/ea</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>fuse-public-repository</id>
<name>FuseSource Community Release Repository</name>
<url>https://repo.fusesource.com/nexus/content/groups/public</url>
</pluginRepository>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>red-hat-ga-repository</id>
<name>Red Hat GA Repository</name>
<url>https://maven.repository.redhat.com/ga</url>
</pluginRepository>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>red-hat-ea-repository</id>
<name>Red Hat EA Repository</name>
<url>https://maven.repository.redhat.com/earlyaccess/all</url>
</pluginRepository>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>jboss-ea-repository</id>
<name>Red Hat JBoss Early Access Repository</name>
<url>http://repository.jboss.org/nexus/content/groups/ea</url>
</pluginRepository>
</pluginRepositories>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${version.maven-bundle-plugin}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>myJavaDsl</Bundle-SymbolicName>
<Bundle-Name>Camel Content-Based Router Example using the Java DSL [myJavaDsl]</Bundle-Name></instructions></configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<mainClass>com.mycompany.camel.Launcher</mainClass>
<includePluginDependencies>false</includePluginDependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>
Red Hat Developer Studio,版本:12.9。0.GA
fuse-karaf-7.1.0.fuse-710023-redhat-00001
jdk1.8.0_121
C:\apache-maven-3.6.0
Using Quickstart projects are referred to in Red Hat Fuse Tooling User Guide - PDF
检查 C:\ 的文件夹权限并使用如下所述的 uri:
从("file://C:/AAAInput/?autoCreate=true&noop=true")
看起来你的路线根本没有开始。尝试使用直接引用来路由构建器而不是像这样的包扫描:
<camel:camelContext id="aaa.bbb.ccc.jar" xmlns="http://camel.apache.org/schema/blueprint">
<camel:routeBuilder ref="routeBuilder"/>
</camel:camelContext>
<bean id="routeBuilder" class="aaa.bbb.ccc.jar.CamelRoute" />
我执行了以下步骤以使其与 Fuse 运行时一起工作:
- 创建一个新的 Fuse 集成项目 - Standalone,Karaf / Fuse on Karaf,CBR - Java DSL
- 新建文件夹和文件“src/main/resources/OSGI-INF/blueprint/blueprint.xml
- blueprint.xml 文件内容:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<bean class="com.mycompany.camel.CamelRoute" id="myRouteBuilder"/>
<camelContext id="cbr-example-context" xmlns="http://camel.apache.org/schema/blueprint">
<routeBuilder ref="myRouteBuilder"/>
</camelContext>
</blueprint>
- 在 Red Hat Developer Studio 中通过 Servers 视图部署项目
因为该文件位于我们 JAR 中的 OSGI-INF/blueprint 目录中,所以它会在安装包后立即自动激活。这是可能的,因为 Red Hat Fuse 将 Apache Karaf 与 Blueprint 部署器结合使用 - 请参阅 Deploying into Apache Karaf - OSGi Services
无论如何,提供的模板应该开箱即用。因此,我向 Fuse Tooling 的开发人员提出了一个问题 - https://issues.jboss.org/browse/FUSETOOLS-3178