部署模块时spring-xd集群中的问题



我有一个模块s3 puller,它从was s3中提取文件。在生产中,当我试图创建流时,我遇到了一些问题。但本地单节点运行良好,我尝试在本地设置3个节点集群和1个管理节点,运行良好。以下是我的应用程序上下文

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:int="http://www.springframework.org/schema/integration"
       xmlns:int-aws="http://www.springframework.org/schema/integration/aws"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
        http://www.springframework.org/schema/integration/aws http://www.springframework.org/schema/integration/aws/spring-integration-aws-1.0.xsd">
    <int:poller fixed-delay="${fixed-delay}" default="true"/>
    <bean id="credentials" class="org.springframework.integration.aws.core.BasicAWSCredentials">
        <property name="accessKey" value="${accessKey}"/>
        <property name="secretKey" value="${secretKey}"/>
    </bean>
    <bean
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location">
            <value>dms-aws-s3-nonprod.properties</value>
        </property> 
    </bean>  
    <bean id="clientConfiguration" class="com.amazonaws.ClientConfiguration">
        <property name="proxyHost" value="${proxyHost}"/>
        <property name="proxyPort" value="${proxyPort}"/>
    <property name="preemptiveBasicProxyAuth" value="false"/> 
    </bean>
    <bean id="s3Operations" class="org.springframework.integration.aws.s3.core.CustomC1AmazonS3Operations">
        <constructor-arg index="0" ref="credentials"/>
        <constructor-arg index="1" ref="clientConfiguration"/>
        <property name="awsEndpoint" value="s3.amazonaws.com"/>
        <property name="temporaryDirectory" value="${temporaryDirectory}"/>
        <property name="awsSecurityKey"  value="${awsSecurityKey}"/>
    </bean>

    <!-- aws-endpoint="https://s3.amazonaws.com"  -->
    <int-aws:s3-inbound-channel-adapter aws-endpoint="s3.amazonaws.com"
                                        bucket="${bucket}"
                                        s3-operations="s3Operations"
                                        credentials-ref="credentials"
                                        file-name-wildcard="${file-name-wildcard}"
                                        remote-directory="${remote-directory}"
                                        channel="splitChannel"
                                        local-directory="${local-directory}"
                                        accept-sub-folders="false"
                                        delete-source-files="true"
                                        archive-bucket="${archive-bucket}"
                                        archive-directory="${archive-directory}">
    </int-aws:s3-inbound-channel-adapter>
    <int:splitter input-channel="splitChannel" output-channel="output"
          expression="T(org.apache.commons.io.FileUtils).lineIterator(payload)"/>
    <int:channel id="output"/>

我的应用程序.java包com.capitalone.api.dms.main;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ImportResource;
    @SpringBootApplication
    @ImportResource("classpath:config/applicationContext.xml")
    public class Application {
        public static void main(String[] args) throws Exception {
            new SpringApplicationBuilder(Application.class)
                    .web(false)
                    .showBanner(false)
                    .properties("security.basic.enabled=false")
                    .run(args);
        }
    }

当我尝试创建一个基本流时,我得到了以下异常

module upload --file   aws.jar  --name aws-s3-options --type source
stream create feedTest91 --definition "aws-s3-options    | log" --deploy

我得到低于异常

DeploymentStatus{state=failed,error(s)=org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'objectNameProperties' defined in null: Could not resolve placeholder 'xd.module.sequence' in string value "${xd.module.sequence}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'xd.module.sequence' in string value "${xd.module.sequence}" at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:211) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:222) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:86) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)

从源代码中,我看到它由xd的jmx-mbean文件加载,并由下面的java文件加载

https://github.com/spring-projects/spring-xd/blob/6923ee8705bd9c2c58ad73120724b8b87c5ba37d/spring-xd-dirt/src/main/resources/META-INF/spring-xd/plugins/jmx/mbean-exporters.xml

https://github.com/spring-projects/spring-xd/blob/e9ce8e897774722c1e61038817ebd55c5cf0befc/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/plugins/MBeanExportingPlugin.java

解决方案:

我正计划从我的s3模块中注入它们。这是正确的方法吗?请让我知道应该是什么值?

<context:mbean-export />

      <int-jmx:mbean-export object-naming-strategy="moduleObjectNamingStrategy" />
        <util:properties id="objectNameProperties">
            <prop key="group">${xd.group.name}</prop>
            <prop key="label">${xd.module.label}</prop>
            <prop key="type">${xd.module.type}</prop>
            <prop key="sequence">${xd.module.sequence}</prop>
        </util:properties>
        <bean id="moduleObjectNamingStrategy"
              class="org.springframework.xd.dirt.module.jmx.ModuleObjectNamingStrategy">
            <constructor-arg value="xd.${xd.stream.name:${xd.job.name:}}" />
            <constructor-arg ref="objectNameProperties" />
        </bean>

该属性应由ModuleInfoPlugin自动设置。

这是第二次有人说财产不知怎么失踪了。

我打开了一期JIRA。

最新更新