6

我对WSO2 ESB非常陌生,消息处理器存在以下问题。

我有这个消息处理器定义,每秒从队列中提取一个元素(先前存储的 XML 文档)并调用名为transferProcessorSequence的序列对其进行处理。这是配置:

<?xml version="1.0" encoding="UTF-8"?>
<messageProcessor class="org.apache.synapse.message.processor.impl.sampler.SamplingProcessor" messageStore="transferFromMessageStore" name="transferFromMessageProcessor" xmlns="http://ws.apache.org/ns/synapse">
    <parameter name="sequence">transferProcessorSequence</parameter>
    <parameter name="interval">1000</parameter>
    <parameter name="is.active">true</parameter>
    <parameter name="concurrency">1</parameter>
</messageProcessor>

它工作正常。我的问题是我不必每秒都这样做(它不应该是一个固定值),而是必须使用我存储到注册表中的值(最终我可以将此值存储在其他地方)。

而不是这个设置:

<parameter name="interval">1000</parameter>

我必须从注册表或类似的东西(也是一个属性)中检索存储的值。

我怎么能做这样的事情?

**编辑 1:我正在尝试遵循 Jean-Michel 提供的解决方案,但我发现尝试使用 Maven 构建我的项目时遇到了一些困难。

我创建了一个简单的 Maven 项目,这是我的pom.xml文件内容(此时我还没有实现 Java 类,我只是想编译一个空项目):

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany.toolkit</groupId>
    <artifactId>SamplingProcessorHeaderRateLimitation</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>bundle</packaging>
    <name>Sampling Processor Header Rate Limitation</name>
    <description>Custom Sampling Mesageprocessor using response header to implement the rate limitation</description>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.4</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>com.sample.messageprocessor</Bundle-SymbolicName>
                        <Bundle-Name>com.sample.messageprocessor</Bundle-Name>
                        <Export-Package>com.sample.*</Export-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                        <Implementation-Build>${buildNumber}</Implementation-Build>
                        <Scm-Root>${project.scm.connection}</Scm-Root>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <releases>
                <updatePolicy>daily</updatePolicy>
                <checksumPolicy>ignore</checksumPolicy>
            </releases>
            <id>wso2-nexus</id>
            <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <releases>
                <updatePolicy>daily</updatePolicy>
                <checksumPolicy>ignore</checksumPolicy>
            </releases>
            <id>wso2-nexus</id>
            <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
        </pluginRepository>
    </pluginRepositories>
    <dependencies>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-core</artifactId>
            <version>2.1.7-wso2v3</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.1</version>
        </dependency>
    </dependencies>
    <properties>
        <CApp.type>lib/synapse/mediator</CApp.type>
    </properties>
</project>

问题是,当我执行此 Maven 项目的mvn 包语句时,我收到以下错误消息:

nobil@DESKTOP-VCON7T6 MINGW64 ~/OneDrive/Documenti/MyCompany/JAVA/workspace-sts-3.8.4.RELEASE/SamplingProcessorHeaderRateLimitation
$ mvn -e package
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Sampling Processor Header Rate Limitation 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ SamplingProcessorHeaderRateLimitation ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.0:compile (default-compile) @ SamplingProcessorHeaderRateLimitation ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ SamplingProcessorHeaderRateLimitation ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.0:testCompile (default-testCompile) @ SamplingProcessorHeaderRateLimitation ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.20:test (default-test) @ SamplingProcessorHeaderRateLimitation ---
[INFO]
[INFO] --- maven-bundle-plugin:2.3.4:bundle (default-bundle) @ SamplingProcessorHeaderRateLimitation ---
[WARNING] Warning building bundle com.mycompany.toolkit:SamplingProcessorHeaderRateLimitation:bundle:0.0.1-SNAPSHOT : Instructions in Export-Package that are never used: com\.sample\..*|com\.sample
Classpath: Jar:.,Jar:synapse-core,Jar:org.wso2.securevault,Jar:axiom-api,Jar:geronimo-activation_1.1_spec,Jar:geronimo-javamail_1.4_spec,Jar:jaxen,Jar:geronimo-stax-api_1.0_spec,Jar:axiom-impl,Jar:wstx-asl,Jar:log4j,Jar:jline,Jar:commons-cli,Jar:commons-io,Jar:commons-codec,Jar:synapse-commons,Jar:commons-dbcp,Jar:commons-pool,Jar:activation,Jar:axis2-transport-base,Jar:snmp4j-agent,Jar:snmp4j,Jar:axis2-transport-http,Jar:spring-core,Jar:commons-vfs2,Jar:cache-api,Jar:commons-net,Jar:oro,Jar:javax.servlet-api,Jar:bcpkix-jdk15on,Jar:bcprov-jdk15on,Jar:synapse-tasks,Jar:quartz,Jar:c3p0,Jar:slf4j-api,Jar:geronimo-jta_1.1_spec,Jar:commons-collections,Jar:synapse-nhttp-transport,Jar:httpcore,Jar:httpcore-nio,Jar:httpclient,Jar:wso2caching-core,Jar:axis2-clustering,Jar:tomcat-tribes,Jar:tomcat-juli,Jar:tomcat-embed-logging-juli,Jar:xmlunit,Jar:aspectjweaver,Jar:jms,Jar:amqp-client,Jar:antlr-runtime,Jar:stringtemplate,Jar:antlr,Jar:axis2-saaj,Jar:geronimo-saaj_1.3_spec,Jar:axiom-dom,Jar:axis2-kernel,Jar:geronimo-ws-metadata_2.0_spec,Jar:servlet-api,Jar:commons-httpclient,Jar:commons-fileupload,Jar:wsdl4j,Jar:XmlSchema,Jar:woden-api,Jar:XmlSchema,Jar:woden-impl-dom,Jar:woden-impl-commons,Jar:jsr311-api,Jar:junit,Jar:hamcrest-core,Jar:handy-uri-templates,Jar:commons-lang,Jar:jettison,Jar:jettison,Jar:stax-api,Jar:json-path,Jar:json-smart,Jar:wso2eventing-api,Jar:axis2-adb,Jar:sandesha2-core,Jar:axis2-codegen,Jar:neethi,Jar:axis2-mtompolicy,Jar:saxon-dom,Jar:saxon,Jar:xalan,Jar:serializer,Jar:xml-apis,Jar:axis2-transport-local,Jar:json-schema-validator-all,Jar:json-schema-validator,Jar:jsr305,Jar:joda-time,Jar:libphonenumber,Jar:mailapi,Jar:jopt-simple,Jar:json-schema-core,Jar:rhino,Jar:uri-template,Jar:guava,Jar:msg-simple,Jar:btf,Jar:jackson-coreutils,Jar:jackson-databind,Jar:jackson-annotations,Jar:jackson-core,Jar:commons-logging

[WARNING] Warning building bundle com.mycompany.toolkit:SamplingProcessorHeaderRateLimitation:bundle:0.0.1-SNAPSHOT : Superfluous export-package instructions: [com.sample.*]
[ERROR] Error building bundle com.mycompany.toolkit:SamplingProcessorHeaderRateLimitation:bundle:0.0.1-SNAPSHOT : The JAR is empty: dot
[ERROR] Error(s) found in bundle configuration
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.568 s
[INFO] Finished at: 2017-07-17T14:25:45+02:00
[INFO] Final Memory: 16M/284M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.felix:maven-bundle-plugin:2.3.4:bundle (default-bundle) on project SamplingProcessorHeaderRateLimitation: Error(s) found in bundle configuration -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.felix:maven-bundle-plugin:2.3.4:bundle (default-bundle) on project SamplingProcessorHeaderRateLimitation: Error(s) found in bundle configuration
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error(s) found in bundle configuration
        at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:341)
        at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:224)
        at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:215)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: org.apache.maven.plugin.MojoFailureException: Error(s) found in bundle configuration
        at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:293)
        ... 24 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

所以为什么?问题是什么?我想也许我必须配置manven-bundle-plugin插件。但是我到底该怎么做才能正确配置它呢?这个插件有什么作用?

4

5 回答 5

3

选项 1:开发自定义 MessageProcessor,SamplingProcessor从 WSO2 扩展类。(看看https://github.com/wso2/wso2-synapse modules\core\src\main\java\org\apache\synapse\message\processor\impl)

扩展org.apache.synapse.message.processor.impl.sampler.SamplingProcessor(或直接org.apache.synapse.message.processor.impl.ScheduledMessageProcessor)和覆盖方法setParameters

调用super.setParameters,然后使用您可以在所需位置读取的值更新间隔属性。

在您的 MessageProcessor 定义中,在类 XML 属性后面使用您自己的类

选项 2:使用管理服务

  • 编辑 carbon.xml 并将 HideAdminServiceWSDLs 设置为 false
  • 管理服务监听https://host:9443/carbon
  • 你会发现一个名为的管理服务MessageProcessorAdminService

样本pom.xmlcompile/package您的自定义消息处理器:

<?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.sample</groupId>
    <artifactId>MyMessageProcessors</artifactId>
    <version>1.0.0</version>
    <packaging>bundle</packaging>
    <name>custom MessageProcessors</name>
    <description>sample</description>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.4</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>com.sample.messageprocessor</Bundle-SymbolicName>
                        <Bundle-Name>com.sample.messageprocessor</Bundle-Name>
                        <Export-Package>com.sample.*</Export-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                        <Implementation-Build>${buildNumber}</Implementation-Build>
                        <Scm-Root>${project.scm.connection}</Scm-Root>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <releases>
                <updatePolicy>daily</updatePolicy>
                <checksumPolicy>ignore</checksumPolicy>
            </releases>
            <id>wso2-nexus</id>
            <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <releases>
                <updatePolicy>daily</updatePolicy>
                <checksumPolicy>ignore</checksumPolicy>
            </releases>
            <id>wso2-nexus</id>
            <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
        </pluginRepository>
    </pluginRepositories>
    <dependencies>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-core</artifactId>
            <version>2.1.7-wso2v3</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.1</version>
        </dependency>
    </dependencies>
    <properties>
        <CApp.type>lib/synapse/mediator</CApp.type>
    </properties>
</project>
  • 适应groupId,artifactIdversion
  • maven-bundle-plugin在配置中调整包
  • mvn package从命令行执行
于 2017-07-17T09:14:41.897 回答
2

正如其他人所提到的,您需要通过扩展 SampleProcessor 并覆盖 setParameter 方法来创建自己的消息处理器。

org.apache.synapse.message.processor.impl.sampler.SamplingProcessor

其中 setParameters 方法从注册表读取参数并覆盖参数映射。

自定义消息处理器,它从注册管理空间中定义的属性文件中读取参数

package org.apache.synapse.message.custom.processor.impl;

import java.io.IOException;
import java.io.StringReader;
import java.util.Map;
import java.util.Properties;

import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.RegistryType;
import org.wso2.carbon.registry.api.Registry;
import org.wso2.carbon.registry.api.RegistryException;
import org.wso2.carbon.registry.api.Resource;

import org.apache.synapse.message.processor.impl.sampler.SamplingProcessor;;

public class CustomSamplingProcessor extends SamplingProcessor {
    private final static String REGISTRY_PATH = "reg";

    @Override
    public void setParameters(Map<String, Object> parameters) {
        if (parameters.get(REGISTRY_PATH) != null) {
            String resourcePath = (String) parameters.get(REGISTRY_PATH);
            parameters = populateParamsFromReg(resourcePath, parameters);
        }
        System.out.println("############################## set params################");
        super.setParameters(parameters);
    }

    private Map<String, Object> populateParamsFromReg(String resourcePath, Map<String, Object> parameters) {
        Properties prop = readPropertyFile(resourcePath);
        if (prop != null) {
            for (String key : prop.stringPropertyNames()) {
                String value = prop.getProperty(key);
                parameters.put(key, value);
            }
        }
        return parameters;
    }

    private Properties readPropertyFile(String resourcePath) {
        Properties prop = null;
        try {
            CarbonContext cCtx = CarbonContext.getThreadLocalCarbonContext();
            Registry registry = cCtx.getRegistry(RegistryType.USER_GOVERNANCE);
            Resource resource = registry.get(resourcePath);
            Object content = resource.getContent();
            String output = new String((byte[]) content);
            System.out.println(output);
            prop = parseProperties(output);
        } catch (RegistryException e) {
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return prop;
    }

    public Properties parseProperties(String fileContent) throws IOException {
        final Properties properties = new Properties();
        properties.load(new StringReader(fileContent));
        return properties;
    }
}

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.apache.synapse.message.custom.processor.impl</groupId>
    <artifactId>custom-message-processor</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>

    <name>message.custom.processor</name>
    <url>http://maven.apache.org</url>
    <repositories>
        <repository>
            <id>wso2-nexus</id>
            <name>WSO2 internal Repository</name>
            <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
                <checksumPolicy>fail</checksumPolicy>
            </releases>
        </repository>
    </repositories>


    <dependencies>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-core</artifactId>
            <version>2.1.2-wso2v4</version>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.registry.api</artifactId>
            <version>4.3.0</version>
        </dependency>

        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.registry.core</artifactId>
            <version>4.3.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

创建一个属性文件并添加应该从注册表中读取的参数,例如

注册表中的文件位置

/_system/governance/custom-message-processor/customprocessor.properties

内容

interval:1000
concurrency:1
sequence:replySeq
is.active:true

如何在EI中使用自定义处理器

  1. 构建自定义消息处理器,并将 jar 添加到<EI_HOME>\lib(因为这个 jar 不是 osgi jar)
  2. 重启/启动 EI
  3. 将属性文件添加到注册表
  4. 创建自定义消息处理器并将属性文件的注册表文件路径作为参数添加到自定义消息处理器配置中,参数名称为“ reg ”(给出相对注册表路径,因为在代码级别我们从治理空间读取。即/custom-message-processor /customprocessor.properties)。

  <messageProcessor xmlns="http://ws.apache.org/ns/synapse" class="org.apache.synapse.message.custom.processor.impl.CustomSamplingProcessor" name="CustomSamplingProcessor" messageStore="JMSMS">   
       <parameter name="reg">/custom-message-processor/customprocessor.properties</parameter>   
  </messageProcessor>

完整的源代码可以在这里找到[1] https://github.com/jenananthan/wso2-esb-customization/tree/master/sampling_custom_message_processor

于 2017-07-19T16:20:37.547 回答
0

我相信消息处理器本身不提供这样的功能。但是,可以通过另一种方式做到这一点。我提出了一种没有任何自定义 Java 代码的方法(这可能对您有利,也可能不会)。

假设您希望每 X 秒执行一次(将 X 存储在注册表中)。然后,您将消息处理器间隔保留为 1 秒。然后,按照您的处理器将其消息注入的顺序,首先查看您存储为全局属性的计数器。计数器会记录您跳过该操作的次数。如果跳过的计数器小于 X - 1,则增加计数器并且不执行任何操作。如果跳过的计数器等于 X - 1(或更高,如果您在注册表中更改 X 可能会发生这种情况),则将计数器重置为零并执行操作。

于 2017-07-17T08:59:20.027 回答
0

好吧,如果您正在使用,您可以在应用程序类路径Spring中使用一个文件,并使用PropertyPlaceholderConfigurer从这个外部共享属性文件加载资源。这是您应该在 XML 文件中声明的方式:application.propertiesPropertyPlaceholderConfigurer

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <value>classpath:wso2esb.properties</value>
    </property>
</bean>

<bean id="messageProcessor" 
   class="org.apache.synapse.message.processor.impl.sampler.SamplingProcessor" messageStore="transferFromMessageStore" name="transferFromMessageProcessor" xmlns="http://ws.apache.org/ns/synapse">
    <property name="sequence" value="${wso2esb.sequence}"/>
    <property name="interval" value="${wso2esb.interval}"/>
    <property name="isactive" value="${wso2esb.isactive}"/>
    <property name="concurrency" value="${wso2esb.concurrency}"/>
</bean>

您只需要在此属性文件中更新 WSO2 ESB 的属性和参数。

有关更多详细信息,您可以查看:

于 2017-07-17T08:47:14.213 回答
0

看起来这不是 WSO2ESB 开箱即用的。但是你可以尝试覆盖

org.apache.synapse.message.processor.impl.sampler.SamplingProcessor

并编写自定义逻辑以从注册表或任何其他来源中提取间隔的参数值,而不是使用 XML 配置,并在您的 XML 配置中使用该覆盖的实现

<?xml version="1.0" encoding="UTF-8"?>
<messageProcessor class="my.custom.CustomSamplingProcessor" messageStore="transferFromMessageStore" name="transferFromMessageProcessor" xmlns="http://ws.apache.org/ns/synapse">
    <parameter name="sequence">transferProcessorSequence</parameter>
    <parameter name="is.active">true</parameter>
    <parameter name="concurrency">1</parameter>
</messageProcessor>
于 2017-07-17T08:40:29.657 回答