manage-global-configurations
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseManage 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 , properties files, and validated pom.xml dependencies — all following MuleSoft best practices.
global-configs.xml通过交互式多轮工作流,创建、查看、编辑、删除、列出、验证和整合Mule 4项目中的所有全局配置。
你将构建的内容: 完全配置好的全局元素(位于)、属性文件以及经过验证的pom.xml依赖项——全部遵循MuleSoft最佳实践。
global-configs.xmlArchitecture
架构
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:
- A Mule 4 project in the workspace with standard structure (,
src/main/mule/,src/main/resources/)pom.xml - Anypoint CLI v4 installed with the DX Mule plugin ()
@mulesoft/anypoint-cli-dx-mule-plugin - Java 11+ and Maven available for build validation
- Mule Runtime available for metadata commands
dx mule describe-connector
开始之前,请确保你已具备:
- 工作区中的Mule 4项目,具有标准结构(、
src/main/mule/、src/main/resources/)pom.xml - 已安装Anypoint CLI v4并带有DX Mule插件()
@mulesoft/anypoint-cli-dx-mule-plugin - **Java 11+**和Maven,用于构建验证
- 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: ,
projectDirconnectorName
-
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: ,
projectDirelementType
-
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等)
- 所需信息:、
projectDirconnectorName
-
创建全局元素:步骤1、2、12
- 适用场景:用户要求添加TLS Context、Object Store、缓存策略、错误处理器、自动发现或导入
- 所需信息:、
projectDirelementType
-
管理属性:步骤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, or any MCP-based tool.get_asset - 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 metadata is the source of truth.
describe-connector - 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 . See
global-configs.xmlfor ordering and structure.references/global-config-conventions.md - pom.xml dependency is MANDATORY. Every global element that requires a dependency (connectors, Object Store, API AutoDiscovery, imports) MUST have its dependency added to . Read
pom.xml, add thepom.xmlblock inside<dependency>, and write the file. The build will fail without this. Never skip this step.<dependencies>
Scripts:
This skill includes shell scripts in its own directory. Invoke them with the tool at the absolute path you were given in the "skill is now active" message. Do not use relative paths.
scripts/Bash| Script | Purpose |
|---|---|
| Search Exchange for connector candidates (one GAV per line) |
| Record chosen GAV as a draft |
| Run |
| Turn a saved connector JSON into |
Scripts path: (where is the directory containing this SKILL.md).
<skill-root>/scripts/<skill-root>References:
Read these files with the tool when instructed. Use the absolute path from the "skill is now active" message.
Read| File | Content | When to Read |
|---|---|---|
| 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. |
| Element ordering, namespace management, centralization rules, default project structure, consolidation decision matrix. | When placing elements in |
| Property file formats, | 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或任何基于MCP的工具。get_asset - 绝不要在聊天中输出原始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>
脚本:
本技能在其目录中包含shell脚本。使用工具调用它们,路径为“技能已激活”消息中提供的绝对路径。请勿使用相对路径。
scripts/Bash| 脚本 | 用途 |
|---|---|
| 在Exchange中搜索连接器候选(每行一个GAV) |
| 将选定的GAV记录为草稿 |
| 执行 |
| 将保存的连接器JSON转换为 |
脚本路径:(其中是包含此SKILL.md的目录)。
<skill-root>/scripts/<skill-root>参考资料:
按照指示使用工具读取以下文件,使用“技能已激活”消息中的绝对路径。
Read| 文件 | 内容 | 读取时机 |
|---|---|---|
| 所有元素类型的XML模板、命名空间URI、XSD URL、pom.xml依赖项、属性表、验证规则和连接器配置生成规则。 | 生成任何XML之前——验证结构、必填属性、命名空间和依赖项。 |
| 元素排序、命名空间管理、集中化规则、默认项目结构、整合决策矩阵。 | 在 |
| 属性文件格式、 | 创建/编辑属性文件、设置环境或验证占位符时。 |
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 and STOP. Do not combine this question with any other question. If only one exists, use it without asking.
AskUserQuestionOperation Routing — Level 1 (Domain):
| Keywords | Domain |
|---|---|
| connector, config, connection, Salesforce, HTTP, DB, database, Slack, S3, ServiceNow, Jira, NetSuite, oauth, credentials | → CONNECTOR CONFIG |
| TLS, SSL, trust store, key store, certificate, mTLS | → TLS CONTEXT |
| object store, key-value store, persistent store, os:config | → OBJECT STORE |
| caching, cache strategy, cache scope | → CACHING STRATEGY |
| error handler, global error, default error handler, on-error | → ERROR HANDLER |
| autodiscovery, API gateway, API ID, API Manager | → API AUTODISCOVERY |
| import project, reference project, shared library, JAR import | → IMPORT |
| properties, config.yaml, .properties, placeholder, environment, dev/QA/prod, multi-env, check placeholders, unresolved properties | → PROPERTIES |
| global-property, inline property, name-value | → GLOBAL PROPERTY |
| list all, what global elements, show all configs | → LIST ALL |
| find usages, where is used, which flows reference | → FIND USAGES |
| validate, check config exists, dangling reference | → VALIDATE |
| consolidate, centralize, move to global-config | → CONSOLIDATE |
Operation Routing — Level 2 (Operation):
| Intent | Operation |
|---|---|
| Create / add / set up / configure (new) | → CREATE |
| Get / list / show / view | → GET |
| Edit / update / modify / change | → EDIT |
| Delete / remove / drop | → DELETE |
If unclear, ask:
What would you like to do? (create, view, edit, delete, validate, consolidate)
STOP.
解析目标项目:
每个会话执行一次——在本次对话的所有后续操作中复用结果。
如果工作区中有多个Mule项目,请通过询问用户使用哪一个并STOP。不要将此问题与其他问题合并。如果只有一个项目,则直接使用无需询问。
AskUserQuestion操作路由——第一层(领域):
| 关键词 | 领域 |
|---|---|
| connector, config, connection, Salesforce, HTTP, DB, database, Slack, S3, ServiceNow, Jira, NetSuite, oauth, credentials | → CONNECTOR CONFIG |
| TLS, SSL, trust store, key store, certificate, mTLS | → TLS CONTEXT |
| object store, key-value store, persistent store, os:config | → OBJECT STORE |
| caching, cache strategy, cache scope | → CACHING STRATEGY |
| error handler, global error, default error handler, on-error | → ERROR HANDLER |
| autodiscovery, API gateway, API ID, API Manager | → API AUTODISCOVERY |
| import project, reference project, shared library, JAR import | → IMPORT |
| properties, config.yaml, .properties, placeholder, environment, dev/QA/prod, multi-env, check placeholders, unresolved properties | → PROPERTIES |
| global-property, inline property, name-value | → GLOBAL PROPERTY |
| list all, what global elements, show all configs | → LIST ALL |
| find usages, where is used, which flows reference | → FIND USAGES |
| validate, check config exists, dangling reference | → VALIDATE |
| consolidate, centralize, move to global-config | → CONSOLIDATE |
操作路由——第二层(操作类型):
| 意图 | 操作类型 |
|---|---|
| Create / add / set up / configure (new) | → CREATE |
| Get / list / show / view | → GET |
| Edit / update / modify / change | → EDIT |
| Delete / remove / drop | → DELETE |
如果意图不明确,请询问:
你想要执行什么操作?(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 sfdcIf multiple variants are returned and the user did NOT pre-supply a specific connector artifact, ask user via and STOP. If only one result matches (or the connector is already in ), proceed without asking.
AskUserQuestionpom.xmlThen pick:
bash
bash scripts/pick_connector.sh sfdc com.mulesoft.connectors:mule-salesforce-connector:11.1.0If connector is already in the project's , extract GAV from there instead.
pom.xml如果未指定连接器,请询问用户使用哪个。然后在Exchange中搜索:
bash
bash scripts/get_latest_connector.sh salesforce sfdc如果返回多个变体且用户未预提供特定连接器工件,请通过询问用户并STOP。如果只有一个匹配结果(或连接器已在中),则无需询问直接继续。
AskUserQuestionpom.xml然后选择:
bash
bash scripts/pick_connector.sh sfdc com.mulesoft.connectors:mule-salesforce-connector:11.1.0如果连接器已在项目的中,则从其中提取GAV。
pom.xmlStep 4: Describe Connector
步骤4:描述连接器
bash
bash scripts/describe_connector.sh sfdcRead the and from the digest.
configs[]connectionProvidersbash
bash scripts/describe_connector.sh sfdc从摘要中读取和。
configs[]connectionProvidersStep 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.jsonCheck for child element.
oauthCallbackConfigbash
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检查子元素。
oauthCallbackConfigStep 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 for each required field automatically.
${connectorNamespace.fieldName}Otherwise ask:
Provide values for required fields, or choose "placeholders" forreferences.${property}
STOP (only if not pre-supplied).
如果用户预提供了明确的字段值或表示“使用占位符”/“默认占位符”用于所有字段,则使用该偏好并跳过此STOP。当选择占位符时,自动为每个必填字段生成格式的占位符。
${connectorNamespace.fieldName}否则询问:
请提供必填字段的值,或选择“placeholders”使用引用。${property}
STOP(仅在未预提供时执行)。
Step 9: Generate XML
步骤9:生成XML
Read → "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。
references/global-elements-catalog.mdStep 10: Generate config.yaml
步骤10:生成config.yaml
Only for fields where user chose placeholders. Use pattern.
${namespace.attributeName}仅针对用户选择使用占位符的字段。使用格式。
${namespace.attributeName}Step 11: Apply to Project and Validate
步骤11:应用到项目并验证
- Write config to (create if missing — see
src/main/mule/global-configs.xml).references/global-config-conventions.md - Add namespace + schemaLocation.
- Write/update .
src/main/resources/config.yaml - Add connector dependency to pom.xml (MANDATORY — do not skip):
- Read the project's .
pom.xml - Check if the connector's already exists in
<artifactId>.<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, andartifactIdcome from the GAV saved byversioninpick_connector.sh.tmp/connector-choices/ - Write the updated with the new dependency added.
pom.xml
- Read the project's
- Validate:
bash
cd <project-dir> && mvn clean package -DskipTestsFix and re-run until .
BUILD SUCCESSGET / EDIT / DELETE (Connector Config):
GET: Scan for elements with connection provider children. Display name, type, file, provider, attributes.
src/main/mule/*.xml<*:*-config>EDIT: GET → ask which → show current values → ask for changes → STOP → apply edits → validate.
DELETE: Identify → search all XML for → show usages → confirm → STOP → remove element → clean namespaces → validate.
config-ref="{name}"- 将配置写入(如果不存在则创建——请参阅
src/main/mule/global-configs.xml)。references/global-config-conventions.md - 添加命名空间 + schemaLocation。
- 写入/更新。
src/main/resources/config.yaml - 将连接器依赖项添加到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中的GAV。tmp/connector-choices/ - 写入更新后的。
pom.xml
- 读取项目的
- 验证:
bash
cd <project-dir> && mvn clean package -DskipTests修复问题并重新运行,直到显示。
BUILD SUCCESSGET / EDIT / DELETE(连接器配置):
GET: 扫描中的带有连接提供者子元素的元素。显示名称、类型、文件、提供者、属性。
src/main/mule/*.xml<*:*-config>EDIT: 执行GET → 询问要编辑的配置 → 显示当前值 → 询问更改内容 → STOP → 应用编辑 → 验证。
DELETE: 识别目标配置 → 在所有XML中搜索 → 显示用法 → 确认 → STOP → 删除元素 → 清理命名空间 → 验证。
config-ref="{name}"Step 12: Create Global Element (TLS, Object Store, Caching, Error Handler, AutoDiscovery, Import)
步骤12:创建全局元素(TLS、Object Store、缓存、错误处理器、自动发现、导入)
For all element types below, read for the canonical XML structure, required attributes, and validation rules before generating XML.
references/global-elements-catalog.md对于以下所有元素类型,在生成XML之前,请读取获取标准XML结构、必填属性和验证规则。
references/global-elements-catalog.mdTLS 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 , add namespace, update config.yaml.
global-configs.xmltls问题1: 名称?仅信任存储 / 仅密钥存储 / 两者都要(双向TLS)?
STOP.
问题2: 存储路径、密码(使用占位符)。可选:协议、密码套件、吊销检查、存储类型/算法。
STOP. → 执行:将XML写入,添加命名空间,更新config.yaml。
global-configs.xmltlsOBJECT STORE — CREATE
OBJECT STORE — CREATE
Q1: Need a new , or use existing? Name?
os:configSTOP.
Q2: Object Store name, config-ref, persistent?, maxEntries, entryTtl, TTL unit.
STOP. → Execute:
- Write XML (config BEFORE object-store) to .
global-configs.xml - Add namespace:
osand its schemaLocation entry.xmlns:os="http://www.mulesoft.org/schema/mule/os" - Add dependency to pom.xml (MANDATORY — do not skip):
mule-objectstore-connector- Read and check if
pom.xmlalready exists inmule-objectstore-connector.<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
- Read
- Validate build: .
cd <project-dir> && mvn clean package -DskipTests
问题1: 需要新的,还是使用现有配置?名称?
os:configSTOP.
问题2: Object Store名称、config-ref、是否持久化?maxEntries、entryTtl、TTL单位。
STOP. → 执行:
- 将XML(config在object-store之前)写入。
global-configs.xml - 添加命名空间:
os及其schemaLocation条目。xmlns:os="http://www.mulesoft.org/schema/mule/os" - 将依赖项添加到pom.xml(必须执行——请勿跳过):
mule-objectstore-connector- 读取并检查
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
- 读取
- 验证构建:。
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 namespace, ensure Object Store dependency if inline.
ee问题1: 名称?使用哪个Object Store(现有引用还是内联)?
STOP.
问题2: 密钥生成表达式?事件复制策略(simple/serializable)?是否同步?
STOP. → 执行:写入XML,添加命名空间,如果使用内联Object Store则确保添加其依赖项。
eeERROR 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 + if default. Add namespace if using .
<configuration defaultErrorHandler-ref="..."/>ee<ee:transform>问题1: 名称?使用什么策略?(on-error-continue / on-error-propagate)。每个策略对应哪些错误类型?
STOP.
问题2: 每个策略应执行什么操作?(log, set payload, set status code)。是否设置为默认?
STOP. → 执行:写入XML + 如果设置为默认则添加。如果使用则添加命名空间。
<configuration defaultErrorHandler-ref="..."/><ee:transform>eeAPI AUTODISCOVERY — CREATE
API AUTODISCOVERY — CREATE
Q1: API ID? Which flow? (show available flows from project scan).
STOP.
Q2: Optional settings (ignoreBasePath, etc.).
STOP. → Execute:
- Write XML to :
global-configs.xmlxml<api-gateway:autodiscovery apiId="${api.id}" flowRef="{flow-name}" doc:name="API AutoDiscovery" /> - Add namespace:
api-gatewayand its schemaLocation entry.xmlns:api-gateway="http://www.mulesoft.org/schema/mule/api-gateway" - Add dependency to pom.xml (MANDATORY — do not skip):
mule-api-gateway- Read and check if
pom.xmlalready exists inmule-api-gateway.<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
- Read
- Add to config.yaml (MANDATORY — do not skip):
api.id- Read .
src/main/resources/config.yaml - Add (or user-specified value) under an appropriate section.
api.id: "YOUR_API_ID" - Write the updated config.yaml.
- Read
- Validate build: .
cd <project-dir> && mvn clean package -DskipTests
问题1: API ID?使用哪个流?(显示项目扫描得到的可用流)。
STOP.
问题2: 可选设置(ignoreBasePath等)。
STOP. → 执行:
- 将XML写入:
global-configs.xmlxml<api-gateway:autodiscovery apiId="${api.id}" flowRef="{flow-name}" doc:name="API AutoDiscovery" /> - 添加命名空间:
api-gateway及其schemaLocation条目。xmlns:api-gateway="http://www.mulesoft.org/schema/mule/api-gateway" - 将依赖项添加到pom.xml(必须执行——请勿跳过):
mule-api-gateway- 读取并检查
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
- 读取
- 将添加到config.yaml(必须执行——请勿跳过):
api.id- 读取。
src/main/resources/config.yaml - 在适当的部分添加(或用户指定的值)。
api.id: "YOUR_API_ID" - 写入更新后的config.yaml。
- 读取
- 验证构建:。
cd <project-dir> && mvn clean package -DskipTests
IMPORT — CREATE
IMPORT — CREATE
Q1: Maven coordinates (groupId, artifactId, version)?
STOP.
Q2: What resources to use? Add declaration?
<import>STOP. → Execute: add dependency to pom.xml, add to global-configs.xml.
<import file="{artifactId}.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 ) → present → confirm → STOP → remove → namespace cleanup → validate.
references/global-elements-catalog.md与连接器配置使用相同的共享模式:
GET: 扫描所有Mule XML中的相关元素模式,按类型分组显示。
EDIT: 列出元素 → 询问要编辑的元素 → 显示当前值 → 询问更改内容 → STOP → 应用更改 → 验证。
DELETE: 识别目标元素 → 根据中的每种类型引用模式查找用法 → 展示结果 → 确认 → STOP → 删除元素 → 清理命名空间 → 验证。
references/global-elements-catalog.mdStep 13: Properties Management
步骤13:属性管理
Read before any properties operation.
references/properties-patterns.md在执行任何属性操作之前,请读取。
references/properties-patterns.mdCREATE FILE
创建文件
Q1: YAML or Properties format? Filename?
STOP.
Q2: Initial key-value pairs (or "empty")? Register as ?
<configuration-properties>STOP. → Execute: create file in , register in if requested.
src/main/resources/global-configs.xml问题1: YAML还是Properties格式?文件名?
STOP.
问题2: 初始键值对(或“empty”)?是否注册为?
<configuration-properties>STOP. → 执行:在中创建文件,如果请求则在中注册。
src/main/resources/global-configs.xmlEDIT 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.yamlSTOP. → Execute: create per-env files, add , add to global-configs.xml.
<global-property name="env" value="{default}"/><configuration-properties file="${env}.yaml"/>问题1: 哪些环境?(dev、QA、prod等)默认环境?
STOP.
问题2: 哪些属性因环境而异?基础中的通用属性?
config.yamlSTOP. → 执行:创建每个环境对应的文件,添加,在中添加。
<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 to global-configs.xml.
<global-property name="..." value="..." doc:name="..."/>Edit: List → ask which → show → ask new value → STOP → apply.
Delete: List → find usages → present → confirm → STOP → remove.
${name}创建问题1: 键值对是什么?
STOP. → 执行:在中添加。
global-configs.xml<global-property name="..." value="..." doc:name="..."/>编辑: 列出元素 → 询问要编辑的元素 → 显示当前值 → 询问新值 → STOP → 应用更改。
删除: 列出元素 → 查找的用法 → 展示结果 → 确认 → STOP → 删除元素。
${name}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
列出所有
- Scan all Mule XML files under .
src/main/mule/ - Identify every top-level element inside that is NOT
<mule>or<flow>.<sub-flow> - Categorize: Connector Configs, Configuration Properties, Global Properties, Global Error Handlers, API AutoDiscovery, TLS Context, Object Store, Caching Strategy, Import References, Application Configuration, Other.
- Count usages per named element (search ,
config-ref,tlsContext,objectStore,cachingStrategy-ref,defaultErrorHandler-ref,errorHandler-ref).listenerConfig - Present grouped table with name, type, file, usage count.
- Highlight issues: unresolved placeholders, scattered configs (not in ), unused elements (0 references).
global-configs.xml
- 扫描下的所有Mule XML文件。
src/main/mule/ - 识别内所有不是
<mule>或<flow>的顶级元素。<sub-flow> - 分类:连接器配置、配置属性、全局属性、全局错误处理器、API AutoDiscovery、TLS Context、Object Store、缓存策略、导入引用、应用配置、其他。
- 统计每个命名元素的使用次数(搜索、
config-ref、tlsContext、objectStore、cachingStrategy-ref、defaultErrorHandler-ref、errorHandler-ref)。listenerConfig - 以分组表格形式展示名称、类型、文件、使用次数。
- 突出显示问题:未解析的占位符、分散的配置(不在中)、未使用的元素(0次引用)。
global-configs.xml
FIND USAGES
查找用法
- Identify target element (list all if not specified, ask which).
- Search ALL Mule XML files for references using per-type patterns:
- — connector operations/sources
config-ref="{name}" - — OAuth callback configs
listenerConfig="{name}" - — HTTP configs
tlsContext="{name}" - — caching strategies
objectStore="{name}" - —
cachingStrategy-ref="{name}"scopes<ee:cache> - —
defaultErrorHandler-ref="{name}"<configuration> - — individual flows
errorHandler-ref="{name}"
- Present: file, line, flow/element, attribute, context snippet.
- 识别目标元素(如果未指定则列出所有,询问用户选择哪个)。
- 使用每种类型的模式搜索所有Mule XML文件中的引用:
- — 连接器操作/源
config-ref="{name}" - — OAuth回调配置
listenerConfig="{name}" - — HTTP配置
tlsContext="{name}" - — 缓存策略
objectStore="{name}" - —
cachingStrategy-ref="{name}"作用域<ee:cache> - —
defaultErrorHandler-ref="{name}"<configuration> - — 单个流
errorHandler-ref="{name}"
- 展示:文件、行号、流/元素、属性、上下文片段。
VALIDATE
验证
Checks that every , , , , , , and attribute in flow XML points to a global element that actually exists in the project.
config-reftlsContextobjectStorecachingStrategy-refdefaultErrorHandler-referrorHandler-reflistenerConfig- Scan all Mule XML under for reference attributes (
src/main/mule/,config-ref="X",tlsContext="X",objectStore="X",cachingStrategy-ref="X",defaultErrorHandler-ref="X",errorHandler-ref="X").listenerConfig="X" - Collect all declared global element names (top-level elements with a attribute).
name - For each reference: check if the referenced name exists in the declared set.
- Report any dangling references — attributes pointing to a global element that does not exist in the project. Include file, line, and the missing name.
- Suggest fix: create the missing global element, or correct the reference to an existing one.
检查流XML中的每个、、、、、和属性是否指向项目中实际存在的全局元素。
config-reftlsContextobjectStorecachingStrategy-refdefaultErrorHandler-referrorHandler-reflistenerConfig- 扫描下的所有Mule XML,查找引用属性(
src/main/mule/、config-ref="X"、tlsContext="X"、objectStore="X"、cachingStrategy-ref="X"、defaultErrorHandler-ref="X"、errorHandler-ref="X")。listenerConfig="X" - 收集所有已声明的全局元素名称(带有属性的顶级元素)。
name - 对于每个引用:检查引用的名称是否存在于已声明的集合中。
- 报告任何悬空引用——指向项目中不存在的全局元素的属性。包括文件、行号和缺失的名称。
- 建议修复:创建缺失的全局元素,或将引用更正为现有元素。
CONSOLIDATE
整合
Read → "Consolidation Decision Matrix" section.
references/global-config-conventions.md- Scan all files for global elements outside .
global-configs.xml - Classify each as movable or flow-coupled (per decision matrix).
- Present report: what to move, what to keep, with reasons.
- Wait for explicit confirmation → STOP.
- Execute: move elements, add namespace declarations, remove from source, clean unused namespaces.
- Validate build: .
mvn clean package -DskipTests - Report: moved count, namespace cleanup, build result.
读取 → “Consolidation Decision Matrix”部分。
references/global-config-conventions.md- 扫描所有文件,查找之外的全局元素。
global-configs.xml - 根据决策矩阵将每个元素分类为可移动或与流耦合。
- 展示报告:要移动的内容、要保留的内容及原因。
- 等待明确确认 → STOP.
- 执行:移动元素、添加命名空间声明、从源文件中删除、清理未使用的命名空间。
- 验证构建:。
mvn clean package -DskipTests - 报告:移动的数量、命名空间清理情况、构建结果。
Tips and Best Practices
提示与最佳实践
- Configuration structure from metadata only. Never hardcode attributes or child elements for connectors. The metadata is the source of truth.
describe-connector - Connector versions from Exchange only. Never paste a version from memory — use →
get_latest_connector.sh.pick_connector.sh - All configs go in . See
global-configs.xmlfor ordering and structure.references/global-config-conventions.md - 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 . This is the #1 cause of build failures. The dependency XML patterns are documented in
pom.xml. Read pom.xml → add dependency → write pom.xml. Do this BEFORE runningreferences/global-elements-catalog.md.mvn clean package - Always update config.yaml for placeholders. When using placeholders in XML, the corresponding property MUST be added to
${property.name}. For AutoDiscovery, always addsrc/main/resources/config.yamlto config.yaml.api.id
- 仅从元数据获取配置结构:绝不要硬编码连接器的属性或子元素。元数据是唯一可信来源。
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:每个需要依赖项的连接器/模块必须添加到中。这是构建失败的首要原因。依赖项XML模式记录在
pom.xml中。读取pom.xml → 添加依赖项 → 写入pom.xml。在执行references/global-elements-catalog.md之前完成此操作。mvn clean package - 始终为占位符更新config.yaml:当在XML中使用占位符时,必须在
${property.name}中添加相应的属性。对于AutoDiscovery,始终将src/main/resources/config.yaml添加到config.yaml中。api.id
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 for the saved JSON.
tmp/connector-choices/ - Unresolved placeholders at runtime: Ensure is registered in
<configuration-properties>and the properties file exists inglobal-configs.xml.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有效。检查中的已保存JSON。
tmp/connector-choices/ - 运行时出现未解析的占位符:确保已在
<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项目