manage-global-configurations

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Manage Global Configurations

管理全局配置

Overview

概述

Create, view, edit, delete, list, validate, and consolidate all global configurations in a Mule 4 project through an interactive, multi-turn workflow.
What you'll build: Fully configured global elements in
global-configs.xml
, properties files, and validated pom.xml dependencies — all following MuleSoft best practices.
通过交互式多轮工作流,创建、查看、编辑、删除、列出、验证和整合Mule 4项目中的所有全局配置。
你将构建的内容: 完全配置好的全局元素(位于
global-configs.xml
)、属性文件以及经过验证的pom.xml依赖项——全部遵循MuleSoft最佳实践。

Architecture

架构

mermaid
flowchart TD
    Start{User Intent} -->|connector, config, connection| CC[Connector Config]
    Start -->|TLS, SSL, certificate| TLS[TLS Context]
    Start -->|object store, key-value| OS[Object Store]
    Start -->|caching, cache strategy| CS[Caching Strategy]
    Start -->|error handler, on-error| EH[Error Handler]
    Start -->|autodiscovery, API gateway| AD[API AutoDiscovery]
    Start -->|import project, shared library| IMP[Import]
    Start -->|properties, config.yaml, env| PROP[Properties]
    Start -->|global-property, inline| GP[Global Property]
    Start -->|list all, show all configs| LIST[List All]
    Start -->|find usages, where is used| FIND[Find Usages]
    Start -->|validate, dangling ref| VAL[Validate]
    Start -->|consolidate, centralize| CON[Consolidate]

    CC --> OP{Operation}
    TLS --> OP
    OS --> OP
    CS --> OP
    EH --> OP
    AD --> OP
    IMP --> OP
    PROP --> OP
    GP --> OP

    OP -->|Create| CREATE[Generate XML + config.yaml + pom.xml]
    OP -->|Get| GET[Scan & Display]
    OP -->|Edit| EDIT[Modify & Validate]
    OP -->|Delete| DELETE[Remove & Cleanup]
mermaid
flowchart TD
    Start{User Intent} -->|connector, config, connection| CC[Connector Config]
    Start -->|TLS, SSL, certificate| TLS[TLS Context]
    Start -->|object store, key-value| OS[Object Store]
    Start -->|caching, cache strategy| CS[Caching Strategy]
    Start -->|error handler, on-error| EH[Error Handler]
    Start -->|autodiscovery, API gateway| AD[API AutoDiscovery]
    Start -->|import project, shared library| IMP[Import]
    Start -->|properties, config.yaml, env| PROP[Properties]
    Start -->|global-property, inline| GP[Global Property]
    Start -->|list all, show all configs| LIST[List All]
    Start -->|find usages, where is used| FIND[Find Usages]
    Start -->|validate, dangling ref| VAL[Validate]
    Start -->|consolidate, centralize| CON[Consolidate]

    CC --> OP{Operation}
    TLS --> OP
    OS --> OP
    CS --> OP
    EH --> OP
    AD --> OP
    IMP --> OP
    PROP --> OP
    GP --> OP

    OP -->|Create| CREATE[Generate XML + config.yaml + pom.xml]
    OP -->|Get| GET[Scan & Display]
    OP -->|Edit| EDIT[Modify & Validate]
    OP -->|Delete| DELETE[Remove & Cleanup]

Prerequisites

前提条件

Before starting, ensure you have:
  1. A Mule 4 project in the workspace with standard structure (
    src/main/mule/
    ,
    src/main/resources/
    ,
    pom.xml
    )
  2. Anypoint CLI v4 installed with the DX Mule plugin (
    @mulesoft/anypoint-cli-dx-mule-plugin
    )
  3. Java 11+ and Maven available for build validation
  4. Mule Runtime available for
    dx mule describe-connector
    metadata commands
开始之前,请确保你已具备:
  1. 工作区中的Mule 4项目,具有标准结构(
    src/main/mule/
    src/main/resources/
    pom.xml
  2. 已安装Anypoint CLI v4并带有DX Mule插件(
    @mulesoft/anypoint-cli-dx-mule-plugin
  3. **Java 11+**和Maven,用于构建验证
  4. Mule Runtime,用于执行
    dx mule describe-connector
    元数据命令

Execution Paths

执行路径

  • Create connector config: Steps 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
    • When: User asks to add a new connector configuration (Salesforce, HTTP, DB, etc.)
    • You'll need:
      projectDir
      ,
      connectorName
  • Create global element: Steps 1, 2, 12
    • When: User asks to add TLS Context, Object Store, Caching Strategy, Error Handler, AutoDiscovery, or Import
    • You'll need:
      projectDir
      ,
      elementType
  • Manage properties: Steps 1, 2, 13
    • When: User asks to create/edit properties files, set up environments, or manage global-property elements
    • You'll need:
      projectDir
  • Management operations: Steps 1, 2, 14
    • When: User asks to list all, find usages, validate, or consolidate global elements
    • You'll need:
      projectDir
  • 创建连接器配置:步骤1、2、3、4、5、6、7、8、9、10、11
    • 适用场景:用户要求添加新的连接器配置(Salesforce、HTTP、DB等)
    • 所需信息:
      projectDir
      connectorName
  • 创建全局元素:步骤1、2、12
    • 适用场景:用户要求添加TLS Context、Object Store、缓存策略、错误处理器、自动发现或导入
    • 所需信息:
      projectDir
      elementType
  • 管理属性:步骤1、2、13
    • 适用场景:用户要求创建/编辑属性文件、设置环境或管理global-property元素
    • 所需信息:
      projectDir
  • 管理操作:步骤1、2、14
    • 适用场景:用户要求列出所有配置、查找用法、验证或整合全局元素
    • 所需信息:
      projectDir

Step 1: Rules and References

步骤1:规则与参考

Rules:
  • Multi-turn interactive. At every "STOP" marker: print only questions as plain text, end your response, and wait. No tools until all questions in that phase are answered.
  • Pre-supplied value extraction (skip-if-provided). Before the first STOP, parse the user's initial request and extract any values they already supplied (e.g., connector name, config name, provider name, field values, placeholder preference). Record these as "pre-supplied." At each subsequent STOP point, check whether the question is already answered by a pre-supplied value — if yes, use that value and skip the STOP entirely. Only ask questions for information NOT provided. If the user says "default placeholders" or "use placeholders for all fields," treat that as the answer to Step 8 and skip its STOP. If ambiguity remains (e.g., user says "basic provider" but metadata lists "basic-connection" and "basic-auth"), still ask.
  • No MCP server tools. ALL Exchange searches and connector operations MUST use ONLY the bash scripts. Never call
    search_asset
    ,
    get_asset
    , or any MCP-based tool.
  • Never output raw XML to chat — always write to file.
  • Never use TaskCreate.
  • Configuration structure from metadata only. Never hardcode attributes, child elements, or provider names for connectors. The
    describe-connector
    metadata is the source of truth.
  • Connector versions from Exchange only. Never paste a version from memory. The only acceptable source is
    get_latest_connector.sh
    pick_connector.sh
    .
  • All configs go in
    global-configs.xml
    .
    See
    references/global-config-conventions.md
    for ordering and structure.
  • pom.xml dependency is MANDATORY. Every global element that requires a dependency (connectors, Object Store, API AutoDiscovery, imports) MUST have its dependency added to
    pom.xml
    . Read
    pom.xml
    , add the
    <dependency>
    block inside
    <dependencies>
    , and write the file. The build will fail without this. Never skip this step.
Scripts:
This skill includes shell scripts in its own
scripts/
directory. Invoke them with the
Bash
tool at the absolute path you were given in the "skill is now active" message. Do not use relative paths.
ScriptPurpose
get_latest_connector.sh <search> [nickname]
Search Exchange for connector candidates (one GAV per line)
pick_connector.sh <nickname> <gav>
Record chosen GAV as a draft
describe_connector.sh <nickname>
Run
dx mule describe-connector
, save JSON, echo digest
build_gav.sh <json>
Turn a saved connector JSON into
groupId:assetId:version
Scripts path:
<skill-root>/scripts/
(where
<skill-root>
is the directory containing this SKILL.md).
References:
Read these files with the
Read
tool when instructed. Use the absolute path from the "skill is now active" message.
FileContentWhen to Read
references/global-elements-catalog.md
XML templates, namespace URIs, XSD URLs, pom.xml dependencies, attribute tables, validation rules, and connector config generation rules for ALL element types.Before generating ANY XML — verify structure, required attributes, namespace, and dependency.
references/global-config-conventions.md
Element ordering, namespace management, centralization rules, default project structure, consolidation decision matrix.When placing elements in
global-configs.xml
, managing namespaces, or running consolidation.
references/properties-patterns.md
Property file formats,
${placeholder}
resolution, multi-env patterns, secure properties, built-in properties, naming conventions, validation rules.
When creating/editing properties files, setting up environments, or validating placeholders.
规则:
  • 多轮交互式流程:在每个“STOP”标记处:仅以纯文本形式打印问题,结束响应并等待。在该阶段的所有问题得到解答前,请勿使用任何工具。
  • 预提供值提取(已提供则跳过):在第一个STOP之前,解析用户的初始请求并提取他们已提供的任何值(例如连接器名称、配置名称、提供者名称、字段值、占位符偏好),记录为“预提供值”。在后续每个STOP点,检查问题是否已由预提供值解答——如果是,则使用该值并完全跳过STOP。仅询问未提供的信息。如果用户表示“默认占位符”或“为所有字段使用占位符”,则将其视为步骤8的答案并跳过该STOP。如果存在歧义(例如用户说“basic provider”但元数据列出了“basic-connection”和“basic-auth”),仍需询问。
  • 禁止使用MCP服务器工具:所有Exchange搜索和连接器操作必须仅使用提供的bash脚本。绝不能调用
    search_asset
    get_asset
    或任何基于MCP的工具。
  • 绝不要在聊天中输出原始XML——始终写入文件。
  • 绝不要使用TaskCreate
  • 仅从元数据获取配置结构:绝不要硬编码连接器的属性、子元素或提供者名称。
    describe-connector
    元数据是唯一可信来源。
  • 仅从Exchange获取连接器版本:绝不要凭记忆粘贴版本号。唯一可接受的来源是
    get_latest_connector.sh
    pick_connector.sh
  • 所有配置均放入
    global-configs.xml
    :有关排序和结构,请参阅
    references/global-config-conventions.md
  • 必须添加pom.xml依赖项:每个需要依赖项的全局元素(连接器、Object Store、API AutoDiscovery、导入)必须将其依赖项添加到
    pom.xml
    中。读取
    pom.xml
    ,在
    <dependencies>
    内添加
    <dependency>
    块并写入文件。缺少此步骤会导致构建失败,绝不能跳过。
脚本:
本技能在其
scripts/
目录中包含shell脚本。使用
Bash
工具调用它们,路径为“技能已激活”消息中提供的绝对路径。请勿使用相对路径。
脚本用途
get_latest_connector.sh <search> [nickname]
在Exchange中搜索连接器候选(每行一个GAV)
pick_connector.sh <nickname> <gav>
将选定的GAV记录为草稿
describe_connector.sh <nickname>
执行
dx mule describe-connector
,保存JSON并回显摘要
build_gav.sh <json>
将保存的连接器JSON转换为
groupId:assetId:version
格式
脚本路径:
<skill-root>/scripts/
(其中
<skill-root>
是包含此SKILL.md的目录)。
参考资料:
按照指示使用
Read
工具读取以下文件,使用“技能已激活”消息中的绝对路径。
文件内容读取时机
references/global-elements-catalog.md
所有元素类型的XML模板、命名空间URI、XSD URL、pom.xml依赖项、属性表、验证规则和连接器配置生成规则。生成任何XML之前——验证结构、必填属性、命名空间和依赖项。
references/global-config-conventions.md
元素排序、命名空间管理、集中化规则、默认项目结构、整合决策矩阵。
global-configs.xml
中放置元素、管理命名空间或执行整合操作时。
references/properties-patterns.md
属性文件格式、
${placeholder}
解析、多环境模式、安全属性、内置属性、命名约定、验证规则。
创建/编辑属性文件、设置环境或验证占位符时。

Step 2: Resolve Target Project and Route Operation

步骤2:解析目标项目并路由操作

Resolve Target Project:
Run once per session — reuse the result for all subsequent operations in this conversation.
If multiple Mule projects exist in the workspace, ask the user which one to use via
AskUserQuestion
and STOP. Do not combine this question with any other question. If only one exists, use it without asking.
Operation Routing — Level 1 (Domain):
KeywordsDomain
connector, config, connection, Salesforce, HTTP, DB, database, Slack, S3, ServiceNow, Jira, NetSuite, oauth, credentialsCONNECTOR CONFIG
TLS, SSL, trust store, key store, certificate, mTLSTLS CONTEXT
object store, key-value store, persistent store, os:configOBJECT STORE
caching, cache strategy, cache scopeCACHING STRATEGY
error handler, global error, default error handler, on-errorERROR HANDLER
autodiscovery, API gateway, API ID, API ManagerAPI AUTODISCOVERY
import project, reference project, shared library, JAR importIMPORT
properties, config.yaml, .properties, placeholder, environment, dev/QA/prod, multi-env, check placeholders, unresolved propertiesPROPERTIES
global-property, inline property, name-valueGLOBAL PROPERTY
list all, what global elements, show all configsLIST ALL
find usages, where is used, which flows referenceFIND USAGES
validate, check config exists, dangling referenceVALIDATE
consolidate, centralize, move to global-configCONSOLIDATE
Operation Routing — Level 2 (Operation):
IntentOperation
Create / add / set up / configure (new)CREATE
Get / list / show / viewGET
Edit / update / modify / changeEDIT
Delete / remove / dropDELETE
If unclear, ask:
What would you like to do? (create, view, edit, delete, validate, consolidate)
STOP.
解析目标项目:
每个会话执行一次——在本次对话的所有后续操作中复用结果。
如果工作区中有多个Mule项目,请通过
AskUserQuestion
询问用户使用哪一个并STOP。不要将此问题与其他问题合并。如果只有一个项目,则直接使用无需询问。
操作路由——第一层(领域):
关键词领域
connector, config, connection, Salesforce, HTTP, DB, database, Slack, S3, ServiceNow, Jira, NetSuite, oauth, credentialsCONNECTOR CONFIG
TLS, SSL, trust store, key store, certificate, mTLSTLS CONTEXT
object store, key-value store, persistent store, os:configOBJECT STORE
caching, cache strategy, cache scopeCACHING STRATEGY
error handler, global error, default error handler, on-errorERROR HANDLER
autodiscovery, API gateway, API ID, API ManagerAPI AUTODISCOVERY
import project, reference project, shared library, JAR importIMPORT
properties, config.yaml, .properties, placeholder, environment, dev/QA/prod, multi-env, check placeholders, unresolved propertiesPROPERTIES
global-property, inline property, name-valueGLOBAL PROPERTY
list all, what global elements, show all configsLIST ALL
find usages, where is used, which flows referenceFIND USAGES
validate, check config exists, dangling referenceVALIDATE
consolidate, centralize, move to global-configCONSOLIDATE
操作路由——第二层(操作类型):
意图操作类型
Create / add / set up / configure (new)CREATE
Get / list / show / viewGET
Edit / update / modify / changeEDIT
Delete / remove / dropDELETE
如果意图不明确,请询问:
你想要执行什么操作?(create, view, edit, delete, validate, consolidate)
STOP.

Step 3: Resolve Connector (CONNECTOR CONFIG — CREATE)

步骤3:解析连接器(CONNECTOR CONFIG — CREATE)

If not specified, ask which connector. Then search Exchange:
bash
bash scripts/get_latest_connector.sh salesforce sfdc
If multiple variants are returned and the user did NOT pre-supply a specific connector artifact, ask user via
AskUserQuestion
and STOP. If only one result matches (or the connector is already in
pom.xml
), proceed without asking.
Then pick:
bash
bash scripts/pick_connector.sh sfdc com.mulesoft.connectors:mule-salesforce-connector:11.1.0
If connector is already in the project's
pom.xml
, extract GAV from there instead.
如果未指定连接器,请询问用户使用哪个。然后在Exchange中搜索:
bash
bash scripts/get_latest_connector.sh salesforce sfdc
如果返回多个变体且用户未预提供特定连接器工件,请通过
AskUserQuestion
询问用户并STOP。如果只有一个匹配结果(或连接器已在
pom.xml
中),则无需询问直接继续。
然后选择:
bash
bash scripts/pick_connector.sh sfdc com.mulesoft.connectors:mule-salesforce-connector:11.1.0
如果连接器已在项目的
pom.xml
中,则从其中提取GAV。

Step 4: Describe Connector

步骤4:描述连接器

bash
bash scripts/describe_connector.sh sfdc
Read the
configs[]
and
connectionProviders
from the digest.
bash
bash scripts/describe_connector.sh sfdc
从摘要中读取
configs[]
connectionProviders

Step 5: Ask Config Name

步骤5:询问配置名称

If the user pre-supplied a config name, use it and skip this STOP. Otherwise ask:
What name for this connector configuration? (e.g.,
salesforceConfig
)
STOP (only if not pre-supplied).
如果用户预提供了配置名称,则使用该名称并跳过此STOP。否则询问:
此连接器配置的名称是什么?(例如:
salesforceConfig
STOP(仅在未预提供时执行)。

Step 6: Select Connection Provider

步骤6:选择连接提供者

If the user pre-supplied a provider name that unambiguously matches one provider from the metadata, use it and skip this STOP. If multiple providers exist and the user did NOT specify one (or the name is ambiguous), ask user.
STOP (only if prompting).
如果用户预提供的提供者名称与元数据中的某个提供者明确匹配,则使用该名称并跳过此STOP。如果存在多个提供者且用户未指定(或名称存在歧义),请询问用户。
STOP(仅在需要提示时执行)。

Step 7: Get Provider Detail

步骤7:获取提供者详情

bash
anypoint-cli-v4 dx mule describe-connector \
  --connector "$(bash scripts/build_gav.sh tmp/connector-choices/sfdc.json)" \
  --type connection-provider \
  --name basic-connection \
  --config-name sfdc-config \
  --output json > tmp/connector-metadata/sfdc-config.json
Check for
oauthCallbackConfig
child element.
bash
anypoint-cli-v4 dx mule describe-connector \
  --connector "$(bash scripts/build_gav.sh tmp/connector-choices/sfdc.json)" \
  --type connection-provider \
  --name basic-connection \
  --config-name sfdc-config \
  --output json > tmp/connector-metadata/sfdc-config.json
检查
oauthCallbackConfig
子元素。

Step 8: Ask Field Values

步骤8:询问字段值

If the user pre-supplied explicit field values or indicated "use placeholders" / "default placeholders" for all fields, use that preference and skip this STOP. When placeholders are chosen, generate
${connectorNamespace.fieldName}
for each required field automatically.
Otherwise ask:
Provide values for required fields, or choose "placeholders" for
${property}
references.
STOP (only if not pre-supplied).
如果用户预提供了明确的字段值或表示“使用占位符”/“默认占位符”用于所有字段,则使用该偏好并跳过此STOP。当选择占位符时,自动为每个必填字段生成
${connectorNamespace.fieldName}
格式的占位符。
否则询问:
请提供必填字段的值,或选择“placeholders”使用
${property}
引用。
STOP(仅在未预提供时执行)。

Step 9: Generate XML

步骤9:生成XML

Read
references/global-elements-catalog.md
→ "Connector Config Generation Rules" section. Generate XML following Pattern 1 (attributes) or Pattern 2 (child elements) based on metadata.
读取
references/global-elements-catalog.md
→ “Connector Config Generation Rules”部分。根据元数据,使用模式1(属性)或模式2(子元素)生成XML。

Step 10: Generate config.yaml

步骤10:生成config.yaml

Only for fields where user chose placeholders. Use
${namespace.attributeName}
pattern.
仅针对用户选择使用占位符的字段。使用
${namespace.attributeName}
格式。

Step 11: Apply to Project and Validate

步骤11:应用到项目并验证

  1. Write config to
    src/main/mule/global-configs.xml
    (create if missing — see
    references/global-config-conventions.md
    ).
  2. Add namespace + schemaLocation.
  3. Write/update
    src/main/resources/config.yaml
    .
  4. Add connector dependency to pom.xml (MANDATORY — do not skip):
    • Read the project's
      pom.xml
      .
    • Check if the connector's
      <artifactId>
      already exists in
      <dependencies>
      .
    • If NOT present, add this dependency block inside
      <dependencies>
      :
      xml
      <dependency>
          <groupId>{groupId}</groupId>
          <artifactId>{artifactId}</artifactId>
          <version>{version}</version>
          <classifier>mule-plugin</classifier>
      </dependency>
    • The
      groupId
      ,
      artifactId
      , and
      version
      come from the GAV saved by
      pick_connector.sh
      in
      tmp/connector-choices/
      .
    • Write the updated
      pom.xml
      with the new dependency added.
  5. Validate:
bash
cd <project-dir> && mvn clean package -DskipTests
Fix and re-run until
BUILD SUCCESS
.
GET / EDIT / DELETE (Connector Config):
GET: Scan
src/main/mule/*.xml
for
<*:*-config>
elements with connection provider children. Display name, type, file, provider, attributes.
EDIT: GET → ask which → show current values → ask for changes → STOP → apply edits → validate.
DELETE: Identify → search all XML for
config-ref="{name}"
→ show usages → confirm → STOP → remove element → clean namespaces → validate.
  1. 将配置写入
    src/main/mule/global-configs.xml
    (如果不存在则创建——请参阅
    references/global-config-conventions.md
    )。
  2. 添加命名空间 + schemaLocation。
  3. 写入/更新
    src/main/resources/config.yaml
  4. 将连接器依赖项添加到pom.xml(必须执行——请勿跳过):
    • 读取项目的
      pom.xml
    • 检查连接器的
      <artifactId>
      是否已在
      <dependencies>
      中存在。
    • 如果不存在,在
      <dependencies>
      内添加以下依赖块:
      xml
      <dependency>
          <groupId>{groupId}</groupId>
          <artifactId>{artifactId}</artifactId>
          <version>{version}</version>
          <classifier>mule-plugin</classifier>
      </dependency>
    • groupId
      artifactId
      version
      来自
      pick_connector.sh
      保存在
      tmp/connector-choices/
      中的GAV。
    • 写入更新后的
      pom.xml
  5. 验证:
bash
cd <project-dir> && mvn clean package -DskipTests
修复问题并重新运行,直到显示
BUILD SUCCESS
GET / EDIT / DELETE(连接器配置):
GET: 扫描
src/main/mule/*.xml
中的带有连接提供者子元素的
<*:*-config>
元素。显示名称、类型、文件、提供者、属性。
EDIT: 执行GET → 询问要编辑的配置 → 显示当前值 → 询问更改内容 → STOP → 应用编辑 → 验证。
DELETE: 识别目标配置 → 在所有XML中搜索
config-ref="{name}"
→ 显示用法 → 确认 → STOP → 删除元素 → 清理命名空间 → 验证。

Step 12: Create Global Element (TLS, Object Store, Caching, Error Handler, AutoDiscovery, Import)

步骤12:创建全局元素(TLS、Object Store、缓存、错误处理器、自动发现、导入)

For all element types below, read
references/global-elements-catalog.md
for the canonical XML structure, required attributes, and validation rules before generating XML.
对于以下所有元素类型,在生成XML之前,请读取
references/global-elements-catalog.md
获取标准XML结构、必填属性和验证规则。

TLS CONTEXT — CREATE

TLS CONTEXT — CREATE

Q1: Name? Trust Store only / Key Store only / both (mutual TLS)?
STOP.
Q2: Store paths, passwords (use placeholders). Optional: protocols, cipher suites, revocation check, store type/algorithm.
STOP. → Execute: write XML to
global-configs.xml
, add
tls
namespace, update config.yaml.
问题1: 名称?仅信任存储 / 仅密钥存储 / 两者都要(双向TLS)?
STOP.
问题2: 存储路径、密码(使用占位符)。可选:协议、密码套件、吊销检查、存储类型/算法。
STOP. → 执行:将XML写入
global-configs.xml
,添加
tls
命名空间,更新config.yaml。

OBJECT STORE — CREATE

OBJECT STORE — CREATE

Q1: Need a new
os:config
, or use existing? Name?
STOP.
Q2: Object Store name, config-ref, persistent?, maxEntries, entryTtl, TTL unit.
STOP. → Execute:
  1. Write XML (config BEFORE object-store) to
    global-configs.xml
    .
  2. Add
    os
    namespace:
    xmlns:os="http://www.mulesoft.org/schema/mule/os"
    and its schemaLocation entry.
  3. Add
    mule-objectstore-connector
    dependency to pom.xml
    (MANDATORY — do not skip):
    • Read
      pom.xml
      and check if
      mule-objectstore-connector
      already exists in
      <dependencies>
      .
    • If NOT present, add this dependency block inside
      <dependencies>
      :
      xml
      <dependency>
          <groupId>org.mule.connectors</groupId>
          <artifactId>mule-objectstore-connector</artifactId>
          <version>1.2.5</version>
          <classifier>mule-plugin</classifier>
      </dependency>
    • Write the updated
      pom.xml
      .
  4. Validate build:
    cd <project-dir> && mvn clean package -DskipTests
    .
问题1: 需要新的
os:config
,还是使用现有配置?名称?
STOP.
问题2: Object Store名称、config-ref、是否持久化?maxEntries、entryTtl、TTL单位。
STOP. → 执行:
  1. 将XML(config在object-store之前)写入
    global-configs.xml
  2. 添加
    os
    命名空间:
    xmlns:os="http://www.mulesoft.org/schema/mule/os"
    及其schemaLocation条目。
  3. mule-objectstore-connector
    依赖项添加到pom.xml
    (必须执行——请勿跳过):
    • 读取
      pom.xml
      并检查
      mule-objectstore-connector
      是否已在
      <dependencies>
      中存在。
    • 如果不存在,在
      <dependencies>
      内添加以下依赖块:
      xml
      <dependency>
          <groupId>org.mule.connectors</groupId>
          <artifactId>mule-objectstore-connector</artifactId>
          <version>1.2.5</version>
          <classifier>mule-plugin</classifier>
      </dependency>
    • 写入更新后的
      pom.xml
  4. 验证构建:
    cd <project-dir> && mvn clean package -DskipTests

CACHING STRATEGY — CREATE

CACHING STRATEGY — CREATE

Q1: Name? Which Object Store to use (existing reference or inline)?
STOP.
Q2: Key generation expression? Event copy strategy (simple/serializable)? Synchronized?
STOP. → Execute: write XML, add
ee
namespace, ensure Object Store dependency if inline.
问题1: 名称?使用哪个Object Store(现有引用还是内联)?
STOP.
问题2: 密钥生成表达式?事件复制策略(simple/serializable)?是否同步?
STOP. → 执行:写入XML,添加
ee
命名空间,如果使用内联Object Store则确保添加其依赖项。

ERROR HANDLER — CREATE

ERROR HANDLER — CREATE

Q1: Name? What strategies? (on-error-continue / on-error-propagate). Which error types per strategy?
STOP.
Q2: What should each strategy do? (log, set payload, set status code). Set as default?
STOP. → Execute: write XML +
<configuration defaultErrorHandler-ref="..."/>
if default. Add
ee
namespace if using
<ee:transform>
.
问题1: 名称?使用什么策略?(on-error-continue / on-error-propagate)。每个策略对应哪些错误类型?
STOP.
问题2: 每个策略应执行什么操作?(log, set payload, set status code)。是否设置为默认?
STOP. → 执行:写入XML + 如果设置为默认则添加
<configuration defaultErrorHandler-ref="..."/>
。如果使用
<ee:transform>
则添加
ee
命名空间。

API AUTODISCOVERY — CREATE

API AUTODISCOVERY — CREATE

Q1: API ID? Which flow? (show available flows from project scan).
STOP.
Q2: Optional settings (ignoreBasePath, etc.).
STOP. → Execute:
  1. Write XML to
    global-configs.xml
    :
    xml
    <api-gateway:autodiscovery apiId="${api.id}" flowRef="{flow-name}" doc:name="API AutoDiscovery" />
  2. Add
    api-gateway
    namespace:
    xmlns:api-gateway="http://www.mulesoft.org/schema/mule/api-gateway"
    and its schemaLocation entry.
  3. Add
    mule-api-gateway
    dependency to pom.xml
    (MANDATORY — do not skip):
    • Read
      pom.xml
      and check if
      mule-api-gateway
      already exists in
      <dependencies>
      .
    • If NOT present, add this dependency block inside
      <dependencies>
      :
      xml
      <dependency>
          <groupId>org.mule.modules</groupId>
          <artifactId>mule-api-gateway</artifactId>
          <version>${app.runtime}</version>
          <classifier>mule-plugin</classifier>
          <scope>provided</scope>
      </dependency>
    • Write the updated
      pom.xml
      .
  4. Add
    api.id
    to config.yaml
    (MANDATORY — do not skip):
    • Read
      src/main/resources/config.yaml
      .
    • Add
      api.id: "YOUR_API_ID"
      (or user-specified value) under an appropriate section.
    • Write the updated config.yaml.
  5. Validate build:
    cd <project-dir> && mvn clean package -DskipTests
    .
问题1: API ID?使用哪个流?(显示项目扫描得到的可用流)。
STOP.
问题2: 可选设置(ignoreBasePath等)。
STOP. → 执行:
  1. 将XML写入
    global-configs.xml
    xml
    <api-gateway:autodiscovery apiId="${api.id}" flowRef="{flow-name}" doc:name="API AutoDiscovery" />
  2. 添加
    api-gateway
    命名空间:
    xmlns:api-gateway="http://www.mulesoft.org/schema/mule/api-gateway"
    及其schemaLocation条目。
  3. mule-api-gateway
    依赖项添加到pom.xml
    (必须执行——请勿跳过):
    • 读取
      pom.xml
      并检查
      mule-api-gateway
      是否已在
      <dependencies>
      中存在。
    • 如果不存在,在
      <dependencies>
      内添加以下依赖块:
      xml
      <dependency>
          <groupId>org.mule.modules</groupId>
          <artifactId>mule-api-gateway</artifactId>
          <version>${app.runtime}</version>
          <classifier>mule-plugin</classifier>
          <scope>provided</scope>
      </dependency>
    • 写入更新后的
      pom.xml
  4. api.id
    添加到config.yaml
    (必须执行——请勿跳过):
    • 读取
      src/main/resources/config.yaml
    • 在适当的部分添加
      api.id: "YOUR_API_ID"
      (或用户指定的值)。
    • 写入更新后的config.yaml。
  5. 验证构建:
    cd <project-dir> && mvn clean package -DskipTests

IMPORT — CREATE

IMPORT — CREATE

Q1: Maven coordinates (groupId, artifactId, version)?
STOP.
Q2: What resources to use? Add
<import>
declaration?
STOP. → Execute: add dependency to pom.xml, add
<import file="{artifactId}.xml"/>
to global-configs.xml.
问题1: Maven坐标(groupId、artifactId、version)?
STOP.
问题2: 使用哪些资源?是否添加
<import>
声明?
STOP. → 执行:将依赖项添加到pom.xml,在global-configs.xml中添加
<import file="{artifactId}.xml"/>

GET / EDIT / DELETE (all element types)

GET / EDIT / DELETE(所有元素类型)

Same shared pattern as Connector Config:
GET: Scan all Mule XML for the relevant element patterns. Display grouped by type.
EDIT: List → ask which → show values → ask changes → STOP → apply → validate.
DELETE: Identify → find usages (per-type reference patterns from
references/global-elements-catalog.md
) → present → confirm → STOP → remove → namespace cleanup → validate.
与连接器配置使用相同的共享模式:
GET: 扫描所有Mule XML中的相关元素模式,按类型分组显示。
EDIT: 列出元素 → 询问要编辑的元素 → 显示当前值 → 询问更改内容 → STOP → 应用更改 → 验证。
DELETE: 识别目标元素 → 根据
references/global-elements-catalog.md
中的每种类型引用模式查找用法 → 展示结果 → 确认 → STOP → 删除元素 → 清理命名空间 → 验证。

Step 13: Properties Management

步骤13:属性管理

Read
references/properties-patterns.md
before any properties operation.
在执行任何属性操作之前,请读取
references/properties-patterns.md

CREATE FILE

创建文件

Q1: YAML or Properties format? Filename?
STOP.
Q2: Initial key-value pairs (or "empty")? Register as
<configuration-properties>
?
STOP. → Execute: create file in
src/main/resources/
, register in
global-configs.xml
if requested.
问题1: YAML还是Properties格式?文件名?
STOP.
问题2: 初始键值对(或“empty”)?是否注册为
<configuration-properties>
STOP. → 执行:在
src/main/resources/
中创建文件,如果请求则在
global-configs.xml
中注册。

EDIT FILE

编辑文件

Q1: List available files → which to edit?
STOP.
Q2: Show current contents → what to add/modify/remove?
STOP. → Execute: apply changes, warn if removed keys are still referenced.
问题1: 列出可用文件 → 要编辑哪个?
STOP.
问题2: 显示当前内容 → 要添加/修改/删除什么?
STOP. → 执行:应用更改,如果删除的键仍被引用则发出警告。

SETUP ENV

设置环境

Q1: Which environments? (dev, QA, prod, etc.) Default environment?
STOP.
Q2: What properties differ per environment? Common properties in base
config.yaml
?
STOP. → Execute: create per-env files, add
<global-property name="env" value="{default}"/>
, add
<configuration-properties file="${env}.yaml"/>
to global-configs.xml.
问题1: 哪些环境?(dev、QA、prod等)默认环境?
STOP.
问题2: 哪些属性因环境而异?基础
config.yaml
中的通用属性?
STOP. → 执行:创建每个环境对应的文件,添加
<global-property name="env" value="{default}"/>
,在
global-configs.xml
中添加
<configuration-properties file="${env}.yaml"/>

REGISTER / UNREGISTER

注册/取消注册

Register: List unregistered files → ask which → add
<configuration-properties file="..." doc:name="..."/>
.
Unregister: List registered files → ask which → warn ("placeholders won't resolve") → confirm → STOP → remove element (keep file).
注册: 列出未注册的文件 → 询问要注册的文件 → 添加
<configuration-properties file="..." doc:name="..."/>
取消注册: 列出已注册的文件 → 询问要取消注册的文件 → 发出警告(“占位符将无法解析”)→ 确认 → STOP → 删除元素(保留文件)。

GLOBAL PROPERTY — CREATE / EDIT / DELETE

GLOBAL PROPERTY — 创建/编辑/删除

Create Q1: What name-value pairs?
STOP. → Execute: add
<global-property name="..." value="..." doc:name="..."/>
to global-configs.xml.
Edit: List → ask which → show → ask new value → STOP → apply.
Delete: List → find
${name}
usages → present → confirm → STOP → remove.
创建问题1: 键值对是什么?
STOP. → 执行:在
global-configs.xml
中添加
<global-property name="..." value="..." doc:name="..."/>
编辑: 列出元素 → 询问要编辑的元素 → 显示当前值 → 询问新值 → STOP → 应用更改。
删除: 列出元素 → 查找
${name}
的用法 → 展示结果 → 确认 → STOP → 删除元素。

GET (View Properties Setup)

GET(查看属性设置)

List: registered files + unregistered files + global properties. Show key counts and registration locations.
列出:已注册文件 + 未注册文件 + 全局属性。显示键的数量和注册位置。

Step 14: Management Operations (List All, Find Usages, Validate, Consolidate)

步骤14:管理操作(列出所有、查找用法、验证、整合)

LIST ALL

列出所有

  1. Scan all Mule XML files under
    src/main/mule/
    .
  2. Identify every top-level element inside
    <mule>
    that is NOT
    <flow>
    or
    <sub-flow>
    .
  3. Categorize: Connector Configs, Configuration Properties, Global Properties, Global Error Handlers, API AutoDiscovery, TLS Context, Object Store, Caching Strategy, Import References, Application Configuration, Other.
  4. Count usages per named element (search
    config-ref
    ,
    tlsContext
    ,
    objectStore
    ,
    cachingStrategy-ref
    ,
    defaultErrorHandler-ref
    ,
    errorHandler-ref
    ,
    listenerConfig
    ).
  5. Present grouped table with name, type, file, usage count.
  6. Highlight issues: unresolved placeholders, scattered configs (not in
    global-configs.xml
    ), unused elements (0 references).
  1. 扫描
    src/main/mule/
    下的所有Mule XML文件。
  2. 识别
    <mule>
    内所有不是
    <flow>
    <sub-flow>
    的顶级元素。
  3. 分类:连接器配置、配置属性、全局属性、全局错误处理器、API AutoDiscovery、TLS Context、Object Store、缓存策略、导入引用、应用配置、其他。
  4. 统计每个命名元素的使用次数(搜索
    config-ref
    tlsContext
    objectStore
    cachingStrategy-ref
    defaultErrorHandler-ref
    errorHandler-ref
    listenerConfig
    )。
  5. 以分组表格形式展示名称、类型、文件、使用次数。
  6. 突出显示问题:未解析的占位符、分散的配置(不在
    global-configs.xml
    中)、未使用的元素(0次引用)。

FIND USAGES

查找用法

  1. Identify target element (list all if not specified, ask which).
  2. Search ALL Mule XML files for references using per-type patterns:
    • config-ref="{name}"
      — connector operations/sources
    • listenerConfig="{name}"
      — OAuth callback configs
    • tlsContext="{name}"
      — HTTP configs
    • objectStore="{name}"
      — caching strategies
    • cachingStrategy-ref="{name}"
      <ee:cache>
      scopes
    • defaultErrorHandler-ref="{name}"
      <configuration>
    • errorHandler-ref="{name}"
      — individual flows
  3. Present: file, line, flow/element, attribute, context snippet.
  1. 识别目标元素(如果未指定则列出所有,询问用户选择哪个)。
  2. 使用每种类型的模式搜索所有Mule XML文件中的引用:
    • config-ref="{name}"
      — 连接器操作/源
    • listenerConfig="{name}"
      — OAuth回调配置
    • tlsContext="{name}"
      — HTTP配置
    • objectStore="{name}"
      — 缓存策略
    • cachingStrategy-ref="{name}"
      <ee:cache>
      作用域
    • defaultErrorHandler-ref="{name}"
      <configuration>
    • errorHandler-ref="{name}"
      — 单个流
  3. 展示:文件、行号、流/元素、属性、上下文片段。

VALIDATE

验证

Checks that every
config-ref
,
tlsContext
,
objectStore
,
cachingStrategy-ref
,
defaultErrorHandler-ref
,
errorHandler-ref
, and
listenerConfig
attribute in flow XML points to a global element that actually exists in the project.
  1. Scan all Mule XML under
    src/main/mule/
    for reference attributes (
    config-ref="X"
    ,
    tlsContext="X"
    ,
    objectStore="X"
    ,
    cachingStrategy-ref="X"
    ,
    defaultErrorHandler-ref="X"
    ,
    errorHandler-ref="X"
    ,
    listenerConfig="X"
    ).
  2. Collect all declared global element names (top-level elements with a
    name
    attribute).
  3. For each reference: check if the referenced name exists in the declared set.
  4. Report any dangling references — attributes pointing to a global element that does not exist in the project. Include file, line, and the missing name.
  5. Suggest fix: create the missing global element, or correct the reference to an existing one.
检查流XML中的每个
config-ref
tlsContext
objectStore
cachingStrategy-ref
defaultErrorHandler-ref
errorHandler-ref
listenerConfig
属性是否指向项目中实际存在的全局元素。
  1. 扫描
    src/main/mule/
    下的所有Mule XML,查找引用属性(
    config-ref="X"
    tlsContext="X"
    objectStore="X"
    cachingStrategy-ref="X"
    defaultErrorHandler-ref="X"
    errorHandler-ref="X"
    listenerConfig="X"
    )。
  2. 收集所有已声明的全局元素名称(带有
    name
    属性的顶级元素)。
  3. 对于每个引用:检查引用的名称是否存在于已声明的集合中。
  4. 报告任何悬空引用——指向项目中不存在的全局元素的属性。包括文件、行号和缺失的名称。
  5. 建议修复:创建缺失的全局元素,或将引用更正为现有元素。

CONSOLIDATE

整合

Read
references/global-config-conventions.md
→ "Consolidation Decision Matrix" section.
  1. Scan all files for global elements outside
    global-configs.xml
    .
  2. Classify each as movable or flow-coupled (per decision matrix).
  3. Present report: what to move, what to keep, with reasons.
  4. Wait for explicit confirmationSTOP.
  5. Execute: move elements, add namespace declarations, remove from source, clean unused namespaces.
  6. Validate build:
    mvn clean package -DskipTests
    .
  7. Report: moved count, namespace cleanup, build result.
读取
references/global-config-conventions.md
→ “Consolidation Decision Matrix”部分。
  1. 扫描所有文件,查找
    global-configs.xml
    之外的全局元素。
  2. 根据决策矩阵将每个元素分类为可移动与流耦合
  3. 展示报告:要移动的内容、要保留的内容及原因。
  4. 等待明确确认STOP.
  5. 执行:移动元素、添加命名空间声明、从源文件中删除、清理未使用的命名空间。
  6. 验证构建:
    mvn clean package -DskipTests
  7. 报告:移动的数量、命名空间清理情况、构建结果。

Tips and Best Practices

提示与最佳实践

  • Configuration structure from metadata only. Never hardcode attributes or child elements for connectors. The
    describe-connector
    metadata is the source of truth.
  • Connector versions from Exchange only. Never paste a version from memory — use
    get_latest_connector.sh
    pick_connector.sh
    .
  • All configs go in
    global-configs.xml
    .
    See
    references/global-config-conventions.md
    for ordering and structure.
  • Multi-turn interactive. At every decision point: print only questions as plain text, end the response, and wait for user input before proceeding.
  • Skip-if-provided. When the user's initial request includes details (config name, provider, placeholder preference, field values), skip the corresponding STOP points. Only ask for information that was NOT provided or is ambiguous.
  • Never output raw XML to chat — always write to file.
  • No MCP server tools. ALL Exchange searches and connector operations MUST use ONLY the bash scripts provided.
  • Always update pom.xml. Every connector/module that needs a dependency MUST be added to
    pom.xml
    . This is the #1 cause of build failures. The dependency XML patterns are documented in
    references/global-elements-catalog.md
    . Read pom.xml → add dependency → write pom.xml. Do this BEFORE running
    mvn clean package
    .
  • Always update config.yaml for placeholders. When using
    ${property.name}
    placeholders in XML, the corresponding property MUST be added to
    src/main/resources/config.yaml
    . For AutoDiscovery, always add
    api.id
    to config.yaml.
  • 仅从元数据获取配置结构:绝不要硬编码连接器的属性或子元素。
    describe-connector
    元数据是唯一可信来源。
  • 仅从Exchange获取连接器版本:绝不要凭记忆粘贴版本号——使用
    get_latest_connector.sh
    pick_connector.sh
  • 所有配置均放入
    global-configs.xml
    :有关排序和结构,请参阅
    references/global-config-conventions.md
  • 多轮交互式流程:在每个决策点:仅以纯文本形式打印问题,结束响应并等待用户输入后再继续。
  • 已提供则跳过:当用户的初始请求包含详细信息(配置名称、提供者、占位符偏好、字段值)时,跳过相应的STOP点。仅询问未提供或存在歧义的信息。
  • 绝不要在聊天中输出原始XML——始终写入文件。
  • 禁止使用MCP服务器工具:所有Exchange搜索和连接器操作必须仅使用提供的bash脚本。
  • 始终更新pom.xml:每个需要依赖项的连接器/模块必须添加到
    pom.xml
    中。这是构建失败的首要原因。依赖项XML模式记录在
    references/global-elements-catalog.md
    中。读取pom.xml → 添加依赖项 → 写入pom.xml。在执行
    mvn clean package
    之前完成此操作。
  • 始终为占位符更新config.yaml:当在XML中使用
    ${property.name}
    占位符时,必须在
    src/main/resources/config.yaml
    中添加相应的属性。对于AutoDiscovery,始终将
    api.id
    添加到config.yaml中。

Troubleshooting

故障排除

  • Build fails after adding config: Check namespace declarations match the connector's XSD URL. Verify the schemaLocation URL is correct.
  • Connector not found in Exchange: Ensure Anypoint CLI is authenticated. Try broader search terms with
    get_latest_connector.sh
    .
  • Describe-connector fails: Verify Java 11+ is available and the connector GAV is valid. Check
    tmp/connector-choices/
    for the saved JSON.
  • Unresolved placeholders at runtime: Ensure
    <configuration-properties>
    is registered in
    global-configs.xml
    and the properties file exists in
    src/main/resources/
    .
  • Namespace conflicts: Run consolidation to centralize all global elements and clean up duplicate namespace declarations.
  • 添加配置后构建失败:检查命名空间声明是否与连接器的XSD URL匹配。验证schemaLocation URL是否正确。
  • 在Exchange中找不到连接器:确保Anypoint CLI已认证。尝试使用
    get_latest_connector.sh
    使用更宽泛的搜索词。
  • Describe-connector执行失败:验证Java 11+可用且连接器GAV有效。检查
    tmp/connector-choices/
    中的已保存JSON。
  • 运行时出现未解析的占位符:确保
    <configuration-properties>
    已在
    global-configs.xml
    中注册,且属性文件存在于
    src/main/resources/
    中。
  • 命名空间冲突:执行整合操作以集中所有全局元素并清理重复的命名空间声明。

Related Jobs

相关任务

  • build-mule-integration: Build Mule flows that reference the global configurations created by this skill
  • secure-mule-app: Configure secure properties encryption for sensitive configuration values
  • create-project-template: Generate a new Mule project with proper structure before adding configurations
  • build-mule-integration:构建引用此技能创建的全局配置的Mule流
  • secure-mule-app:为敏感配置值配置安全属性加密
  • create-project-template:在添加配置之前生成具有正确结构的新Mule项目