MGWC study materials
MGWC study resources

MGWC cheat sheet

MGWC · Keep the key ideas within reach.

Quick reference

Describe and document integration architecture

  • C4 model levels: Context (systems and actors), Container (deployable apps, APIs, queues), Component (flows, connectors), Code; document to the level the audience needs.

  • Architecture decision records (ADRs) capture context, decision, alternatives, and consequences; one file per decision, immutable once accepted, superseded rather than edited.

  • Integration architecture views to document: system context, data flow/sequence, deployment topology (CloudHub vs RTF vs hybrid), network/trust boundaries, and non-functional requirements.

  • Mule application structure artifacts: mule-artifact.json, pom.xml, src/main/mule (flows), src/main/resources (config, properties, DWSL), src/test (MUnit); document API spec location and dependency graph.

  • Exchange asset types: REST API (RAML/OAS), SOAP API (WSDL), HTTP API, Connector, Template, Example, Policy, Custom; each asset versioned independently.

  • Interface contract documentation: RAML/OAS with traits, resourceTypes, and typed examples; the spec is the source of truth for consumers and for mocking.

  • Non-functional requirements to record per interface: expected TPS, payload size, latency SLO, availability target, retention, and RPO/RTO.

  • Dependency and impact mapping: list upstream providers, downstream consumers, shared queues/topics, and rate limits so change impact is traceable.

Quick reference

Design integration solutions using MuleSoft's approach and tooling

  • Anypoint Platform planes: control plane (design, manage), runtime plane (CloudHub, RTF, hybrid), and the gateway (API Manager policies enforced at the API proxy or embedded in the app).

  • API-led tiers: System APIs wrap systems of record; Process APIs orchestrate and apply business logic; Experience APIs shape data for a channel.

  • Anypoint Code Builder / Studio flow building blocks: sources (HTTP Listener, Scheduler, On New Object), processors (Transform, Choice, Scatter-Gather, Until Successful), and operations (connector calls).

  • Scatter-Gather runs branches in parallel and aggregates results; errors fail fast by default - set maxConcurrency and handle partial failure explicitly.

  • Choice router uses first-match-wins on DataWeave expressions; use default route for fallback. For >2 branches consider a DataWeave match or a lookup table.

  • Flow vs sub-flow: sub-flows share the error handler of the caller and cannot have their own error handler or source; flows can.

  • Object Store v2 for cross-instance state (idempotency keys, watermarks); max value size 10 MB per key, TTL configurable, not a database.

  • Batch job: each step processes records in blocks, supports on-complete and max-failures; use for large file/record sets and for partial-success reporting.

Quick reference

Apply API-led connectivity and layered API design

  • Rule of thumb: System API = one system of record, no business logic; Process API = orchestration across systems; Experience API = one consumer/channel.

  • Reuse direction: Experience depends on Process, Process depends on System; never skip downward or call upward, and avoid Experience-to-System direct calls except for trivial passthrough.

  • API granularity: design to the consumer's task, not the backend's table; keep System APIs coarse and stable, Experience APIs narrow and volatile.

  • RAML/OAS design-first: define resources, methods, status codes, schemas, and examples before implementation; generate the interface from the spec.

  • Versioning: put major version in the base URI (/v1); additive changes are minor; breaking changes require a new major version and a deprecation window.

  • Fault schema: standardize error payloads (code, message, correlationId, timestamp) across all layers so consumers handle failures uniformly.

  • Anti-patterns: chatty Experience APIs, business logic in System APIs, shared mutable database between APIs, and a single 'god' Process API for all channels.

  • Contract-first mocking: publish the spec with examples to Exchange and enable an API mocking service so consumers can build before implementation.

Quick reference

Design and manage APIs with API Manager and policies

  • API instance ties an API version in Exchange to a gateway target (API proxy or embedded/autodiscovery in the Mule app via api.id).

  • Policy order matters: policies execute in the order listed; authentication and rate limiting typically precede transformation and logging.

  • Rate limiting: SLA-based tiers keyed to client application; spike control smooths bursts; throttling limits concurrency/requests per period.

  • Client management: each consumer gets a client ID/secret from an application in API Manager; OAuth 2.0 provider or JWT validation enforces identity.

  • Common policies: Client ID Enforcement, OAuth 2.0 Access Token Enforcement, JWT Validation, Rate Limiting, Spike Control, CORS, IP allowlist, Header Injection/Removal, JSON/XML threat protection.

  • Policy application scope: apply at the API level or per-method/resource; use method-level for differentiated limits on expensive operations.

  • Alerts and analytics: configure alerts on response time, error rate, and traffic; API Analytics dashboards derive from gateway events.

  • Promotion: an API instance is environment-specific; the same API version is deployed to Sandbox and Production as separate instances with separate policies.

Quick reference

Ensure reliability, scalability, and performance of integrations

  • Retry pattern: Until Successful with maxRetries and millisBetween; use only for idempotent operations or when paired with an idempotency key.

  • Circuit breaker: trip after N consecutive failures, open for a cool-down, then half-open probe; prevents cascading failure to a degraded backend.

  • Idempotency: store a request key in Object Store or a database with a TTL; duplicate deliveries return the prior result instead of re-executing.

  • CloudHub sizing: workers × vCores determine capacity; vCore equals 0.1 vCPU, 0.5 GB heap, 500 MB disk. Scale horizontally before vertically.

  • Persistent queues (Anypoint MQ / VM) decouple producers from consumers; configure redelivery attempts and a dead-letter queue for poison messages.

  • Transaction boundaries: XA is costly; prefer compensating actions (saga) with an outbox or idempotent retries over distributed two-phase commit.

  • Performance: stream large payloads (repeatable streams, streaming in DataWeave), avoid collecting to memory, paginate API calls, and cache reference data.

  • Backpressure and concurrency: set maxConcurrency on Scatter-Gather, Batch, and VM consumers; monitor queue depth and worker CPU/memory in Anypoint Monitoring.

Quick reference

Secure integrations and APIs

  • Transport vs message security: TLS protects the channel; OAuth 2.0 / JWT / mTLS authenticate the caller; sign or encrypt the payload when intermediaries are untrusted.

  • OAuth 2.0 flows: client credentials for machine-to-machine; authorization code for user-delegated access; never ship client secrets in mobile or browser code.

  • JWT validation: verify signature (JWKS), issuer, audience, expiry (exp/nbf), and scopes; reject on any mismatch before business logic runs.

  • Secret handling: store credentials in secure properties (secure:: placeholders) encrypted with the Mule secure properties tool, or in a secrets manager; never commit to Git.

  • Least privilege: dedicated service accounts per API, scoped database grants, IP allowlists, and per-client SLA tiers in API Manager.

  • Threat protection: JSON/XML threat protection policies for payload size and structure; validate input against the schema; sanitize before logging.

  • PII: mask or omit sensitive fields in logs and analytics; use DataWeave to redact; set log level appropriately in production.

  • mTLS: present a client certificate for system-to-system calls; configure keystore/truststore in the TLS context and rotate certificates before expiry.

Quick reference

Handle data transformation, integration patterns, and error handling

  • DataWeave essentials: input/output directives (payload, attributes, vars), map/filter/reduce, pluck for object-to-array, groupBy, orderBy, and distinctBy.

  • Coercion: use as for type conversion and default for null fallback; ?. and ?? handle null-safe access and defaults.

  • Message structure: payload, attributes (headers/query), and vars; a connector operation replaces payload and attributes - save what you need in vars first.

  • Enterprise Integration Patterns in Mule: Content Enricher (Enrich), Message Router (Choice), Splitter/Aggregator (Scatter-Gather, Batch), Wire Tap, Idempotent Receiver.

  • Error types: MULE:, HTTP:, and custom APP:* via errorType in raise-error; on-error-continue returns a value, on-error-propagate rethrows.

  • Error handler scope: flow-level error handler overrides global; map specific error types first, then a catch-all ANY for unexpected errors.

  • Retry vs DLQ: retry transient errors (timeouts, 5xx); route permanent errors (validation, 4xx) to a dead-letter queue or error channel without retry.

  • Correlation: propagate a correlationId in headers and log it in every layer; return it in the error payload for traceability.

Quick reference

Support deployment, operations, and CI/CD across environments

  • Environments: Design, Sandbox, Production are separate; each has its own client credentials, properties, and API Manager instances. Never reuse production secrets in Sandbox.

  • Deployment targets: CloudHub (managed), Runtime Fabric (Kubernetes-based), or hybrid (on-prem servers); the artifact is the same, config differs per environment.

  • Config externalization: properties files per environment, secure properties for secrets, and environment variables; the same artifact is promoted unchanged.

  • CI/CD pipeline: build (mvn clean package), test (MUnit with coverage gate), publish to Exchange, deploy via Anypoint CLI or the platform API, then run smoke tests.

  • MUnit: mock connectors and processors, assert on payload, attributes, and errors; separate unit and integration suites; fail the build on coverage regression.

  • Release strategies: blue-green or rolling on RTF; CloudHub rolling update; keep the previous artifact version for rollback.

  • Observability: Anypoint Monitoring dashboards, log search, and alerts; forward logs to an external aggregator; track error rate, latency, and throughput.

  • API lifecycle: design, publish to Exchange, deploy, manage (policies), and deprecate; automate each stage so no manual console steps are required.