【问题标题】:WSO2 ESB environment-specific configurationWSO2 ESB 环境特定配置
【发布时间】:2023-09-21 13:00:01
【问题描述】:

我安装了 WSO2 ESB 实例,并试图弄清楚如何根据环境(开发、质量保证、生产)使用动态端点。

我的目标是在所有环境中部署相同的 .car 文件应用程序(包含所有代码和配置),并自动调整端点配置。

我尝试使用治理注册表(建议 here),但据我了解,在不同的“部署路径”上部署相同的端点还需要创建/部署不同的 .car 应用程序(使用对适当环境的静态引用来修改每个服务,这违反了具有可配置端点的想法)。

解决在三个环境中部署一个应用程序的问题的最佳方法是什么,而不需要对代码进行静态引用并避免使用脚本?

【问题讨论】:

    标签: wso2 wso2esb wso2carbon endpoint


    【解决方案1】:

    你有不同的解决方案:

    1) 使用 ESB 嵌入式注册表。

    每个 ESB 实例都有嵌入的注册表以及环境的端点。您需要为每个环境提供一个注册表的 CAR 应用程序(请注意,所有端点都将具有相同的路径)。

    http://wso2.com/library/articles/2014/03/development-and-deployment-of-c-app-based-artifacts-on-multiple-environments/

    https://github.com/sohaniwso2/NewRepoArticle/tree/master/StudentRegistrationProject

    2) 签署治理注册表。

    治理注册表已部署所有端点(主干 - dev、qa、pro 等)。

    每个 ESB 实例都定义了注册表的远程实例并挂载到环境的路径。

    一旦挂载了端点,对于 ESB,您将拥有环境的端点,因此相同的端点可以在每个环境中工作。

    <remoteInstance url="https://host:port/registry">
       <id>instanceId</id>
       <username>username</username>
       <password>password</password>
    </remoteInstance>
    
    <mount path="/_system/governance" overwrite="true"> 
       <instanceId>instanceId</instanceId> 
       <targetPath>/_system/governance/qa</targetPath> 
    </mount>
    

    http://wso2.com/library/tutorials/2010/04/sharing-registry-space-across-multiple-product-instances/

    【讨论】:

    • 谢谢,我能够创建一个包含我所有端点的治理注册表,并且能够“挂载” /trunk 文件夹。但是,它似乎无法安装与主干不同的任何文件夹。我按照link&lt;mount path="/_system/governance" overwrite="true"&gt;   &lt;instanceId&gt;sharedRegistryInstance&lt;/instanceId&gt;   &lt;targetPath&gt;/_system/governance/branches/qa&lt;/targetPath&gt; &lt;/mount&gt; 的说明进行操作,知道如何挂载不同的 targetPaths 吗?
    • 我发现默认情况下,环境的治理注册表路径被命名为 /trunk、/branches/testing 和 /branches/production,但我的 ESB 仍然只能挂载 /trunk目标...关于如何进行的任何建议?