创建自定义服务组合分配的步骤是什么

What are the steps to creating a custom Service Mix distribution

ServiceMix 关于创建自定义分配的 documentation 仅说明了创建自定义 karaf 分配的步骤。我知道 Karaf 是 ServiceMix 的 backbone,而 ServiceMix 是 Karaf 的自定义发行版。

有没有人真正在 servicemix 之上而不是在 karaf 之上构建了自定义 esb?如果有,你是怎么做到的?

您是如何使用 servicemix 的 src 暂存项目的?

好吧,就像 servicemix 本身那样做。说实话,这正是 Karaf 文档中描述的方式。 例如,您可能想查看 here

简而言之,在您的自定义程序集 POM 中定义它,请查看以下代码片段:

    <plugins>
        <plugin>
            <groupId>org.apache.karaf.tooling</groupId>
            <artifactId>karaf-maven-plugin</artifactId>
            <version>${karaf.version}</version>
            <executions>
                <execution>
                    <id>add-features-to-repo</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>features-add-to-repository</goal>
                    </goals>
                    <configuration>
                        <descriptors>
                            <descriptor>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</descriptor>
                            <descriptor>mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features</descriptor>
                            <descriptor>mvn:org.apache.karaf.features/spring/${karaf.version}/xml/features</descriptor>
                            <descriptor>mvn:org.apache.activemq/activemq-karaf/${activemq.version}/xml/features</descriptor>
                            <descriptor>mvn:org.apache.camel.karaf/apache-camel/${camel.version}/xml/features</descriptor>
                            <descriptor>mvn:org.apache.cxf.karaf/apache-cxf/${cxf.version}/xml/features</descriptor>
                            <descriptor>file:${basedir}/target/classes/internal.xml</descriptor>
                            <descriptor>file:${basedir}/target/classes/features.xml</descriptor>
                            <descriptor>file:${basedir}/target/classes/examples.xml</descriptor>
                        </descriptors>
                        <features>
                            <feature>cxf</feature>
                            <feature>obr</feature>
                            <feature>config</feature>
                            <feature>standard</feature>
                            <feature>package</feature>
                            <feature>kar</feature>
                            <feature>ssh</feature>
                            <feature>management</feature>
                            <feature>eventadmin</feature>
                            <feature>activemq-broker-noweb</feature>
                            <feature>activemq-service</feature>
                            <feature>camel</feature>
                            <feature>camel-cxf</feature>
                            <feature>activemq-camel</feature>
                            <feature>camel-blueprint</feature>
                            <feature>war</feature>
                            <feature>jaxrs-api</feature>
                        </features>
                        <includeMvnBasedDescriptors>true</includeMvnBasedDescriptors>
                        <repository>target/features-repo</repository>
                    </configuration>
                    <inherited>false</inherited>
                </execution>
            </executions>
        </plugin>

如果您需要自己的定制 bundles/features 请确保您
a) 为您自己的捆绑包提供一个功能描述符
b) 定义特征 descriptor
c) 告诉插件使用相应的 feature

以下是我在尝试解决此问题时希望采取的一些步骤...

  1. 下载您要构建的服务组合版本的源代码:https://github.com/apache/servicemix/releases
  2. 将源 zip 解压到任意文件夹。
  3. 创建一个具有以下布局的项目:

    • MyESB
      • pom.xml
      • 来源
        • 主要
        • java
  4. pom.xml 中复制内容 apache-service-mix-x.x.x-src/assembly到你的pom.xml

  5. pom.xml 中,替换 artifactId,并将其命名为如下所示:
<parent>
  <groupId>org.apache.servicemix</groupId>
  <artifactId>parent</artifactId>
  <version>5.4.0</version>
</parent>

<groupId>com.mycompany.esb</groupId>
<artifactId>mycustom-esb</artifactId>

<packaging>pom</packaging>
<name>Custom :: ESB</name>
  • 复制apache-service-mix-x.x.x-src/assembly/src/main的资源目录到MyESB/src/main.
  • org.apache.karaf.tooling:features-maven-plugin 或刚刚复制的资源目录中的配置文件进行任何自定义。

For example, If you wanted to add a particular feature you could do the following edits to your pom.xml:

  • Add a features.xml to add-features-to-repo configuration descriptors
  • Add myfeature to the add-features-to-repo features list
  • To have that feature started by default, add the feature to the featuresBoot property located here: MyESB\src\main\filtered-resources\etc\org.apache.karaf.features.cfg
  1. 运行 maven 安装目标!这将在 MyESB/target 文件夹中构建一个 zip 文件。现在你可以解开它 运行 servicemix.bat

  2. 启动 ESB 后,通过在 Karaf 控制台中输入以下命令来验证是否安装了功能:

    features:list | grep myfeature