MCD - Level 1 Cheatsheet
MuleSoft Certified Developer - Level 1
Download free PDFAPI-led connectivity and the application network
API layers and reusable products
- **System APIs** expose controlled access to systems of record and hide backend complexity. **Process APIs** transform, aggregate and orchestrate data across systems. **Experience APIs** shape that data for a particular channel or audience.
- An **application network** connects reusable APIs and integration assets. Design interfaces at a useful granularity so teams can compose capabilities rather than build repeated point-to-point integrations.
- Treat an **API as a product**: define its contract, consumers, documentation, security and lifecycle. Begin with a specification, mock it and obtain stakeholder feedback before implementing it.
- A **Center for Enablement (C4E)** equips teams with reusable assets, standards and guidance. Measure adoption and reuse in delivered applications, alongside the resulting business outcomes.
- **Semantic versioning** separates incompatible contract changes into a major release, compatible additions into a minor release and compatible fixes into a patch. An implementation change that preserves the contract should preserve consumer compatibility.
Design, discover, manage and operate
- **API Designer** authors API specifications and reusable fragments. **Flow Designer** provides browser-based integration development; **Anypoint Studio** provides the desktop Mule development and debugging environment.
- **Anypoint Exchange** publishes and discovers API specifications, connectors, examples, templates and other reusable assets. An API portal presents documentation and consumer access information.
- **API Manager** manages API instances, policies, contracts and SLA tiers. **Runtime Manager** deploys and operates applications and exposes application status, logs and monitoring information.
- **API autodiscovery** links an implementing Mule application to its API Manager instance. The embedded gateway enforces downloaded policies within that application; a separate proxy deployment is another governance arrangement.
- **Client ID Enforcement** checks registered consumer credentials. Consumers register a client application and request API access; approval establishes the applicable contract and SLA tier. A RAML trait documents requirements but does not enforce the policy.
- **SLA-based policies** apply limits associated with consumer contracts. Configure policies in API Manager and let the connected gateway receive them. **API notebooks** demonstrate executable API calls; they are not the policy enforcement point.
RAML contracts and APIkit implementation
Resources, methods and request shapes
- **RAML 1.0** uses YAML indentation to describe resources, methods, parameters, bodies and responses. Start an API document with **#%RAML 1.0**; nested resources extend their parent paths.
- Use resource paths such as **/orders/{orderId}** for an identified item. A concrete request substitutes a value, such as **/orders/PO42**. **Query parameters** filter or modify a request, as in **/orders?year=2020**.
- Declare **uriParameters** on the resource and **queryParameters** under the method. Name parameters consistently; braces belong in the path template, not around the value sent by a client.
- **GET** retrieves a representation, **POST** submits data or creates a subordinate resource, **PUT** replaces the target representation, **PATCH** applies a partial update and **DELETE** removes the target resource.
- A request's **Content-Type** identifies its body format; **Accept** expresses preferred response formats. Match the declared media type and method to the contract, independently of the filename or endpoint name.
Types, reuse and generated interfaces
- RAML **types** define object properties, scalar types, arrays and constraints. Properties are required by default; a trailing **?** or **required: false** makes a property optional. Examples must match the declared structure and types.
- Use **!include** to load external content. **DataType** fragments define reusable types; **NamedExample** fragments define named examples. A singular **example** and a named **examples** map have different structures.
- **Traits** reuse method-level behavior, such as common headers or query parameters. **Resource types** reuse resource patterns. A trait name such as **client-id-required** is a chosen asset name, not a reserved security keyword.
- **APIkit** scaffolds an HTTP entry flow and implementation flows from the contract. Its router validates incoming requests and dispatches them to the matching resource-method implementation; it does not supply the business logic.
- One **APIkit router** can serve the operations in a specification. Generated implementation flows correspond to supported resource-method and representation combinations; count actual generated mappings rather than assuming one router per endpoint.
- **REST Connect** generates a client connector from a published API specification in Exchange. Its operations call API methods; APIkit generates the server-side implementation scaffolding.
Mule events, flows and state
Payload, attributes and variables
- A **Mule event** contains a **message** and **variables**. The message contains the **payload** and **attributes**. Mule 4 uses these structures rather than Mule 3 inbound properties or flowVars.
- The **payload** carries the current body or operation result. **Attributes** carry connector-specific metadata. **Variables**, accessed through **vars**, hold application values associated with the event.
- An HTTP Listener exposes **attributes.queryParams.dept**, **attributes.uriParams.customerId** and **attributes.headers.'content-type'**. Query parameters, path parameters and headers occupy different attribute fields.
- **Set Payload** changes the body; **Set Variable** saves a named value without replacing it. For an object stored in customer, use **vars.customer.first** to select its first property.
- A default **HTTP Request** replaces the message with its response body and response attributes while preserving the caller's variables. Save incoming attributes or data before an operation if they are needed afterward.
- A successful operation configured with a **target variable** stores its result and preserves the input message. The default target value is the result payload; select **message** explicitly when both result payload and attributes are required.
Flow calls and scope boundaries
- A **flow** may have a source, processors and its own error handler. A **private flow** has no source and is invoked internally. A **subflow** has no source or error handler of its own and executes within the caller's handling context.
- A **Flow Reference** invokes another flow or subflow and waits for it to finish. Without a target, successful payload and variable changes return to the caller. Configuring a target preserves the caller's event and captures the selected result.
- An **HTTP call** creates a protocol boundary. The receiving Listener creates its own event; caller variables do not travel automatically over HTTP. Send required values explicitly in the body, headers or parameters.
- An **Async scope** runs a separate branch without waiting for its completion. Changes made inside that branch do not become the main flow's returned event; handle branch failures within the appropriate branch context.
- **Object Store** keeps key-value state across event executions. Configure persistence and expiration for the required lifetime; event variables alone do not retain state for the next independent request.
DataWeave transformations and expressions
Script structure, selectors and functions
- A DataWeave script separates header declarations from its body with **---**. **%dw 2.0** selects the language and **output application/json**, **application/xml** or **application/csv** selects serialization.
- Use **#[expression]** in Mule expression fields. **payload**, **attributes** and **vars** expose the event. An inline expression embedded in a string evaluates its value when the component runs.
- Define a function with **fun toUpper(userName) = upper(userName)**. Parameter names are case-sensitive. Define reusable values with **var**; call functions with parentheses and comma-separated arguments.
- **dw::Core** functions are available automatically. For a module at **src/main/resources/libs/dw/WebStore.dwl**, use **import * from libs::dw::WebStore**, then call the exported function by name.
- Use **==** for equality and **if (...) ... else ...** for conditional values. A single **=** is not an equality test. **default** supplies a fallback when a value is absent or null.
- **lookup(flowName, input)** can invoke a flow from an expression, but a **Flow Reference** is clearer for orchestration and side effects. Keep transformation functions focused on producing values.
Collections, coercion and output formats
- **map** transforms an **Array** into an **Array**, applying a function to each item and index. **mapObject** transforms an **Object** into an **Object**, using value, key and index parameters.
- **filter** retains array items satisfying a condition. **pluck** turns object entries into an array. **reduce** combines array items into an accumulated result, such as a total.
- **flatten** removes one array nesting level and returns an array. **zip** pairs corresponding elements of two arrays into arrays of pairs, stopping at the shorter input.
- **++** concatenates compatible strings or combines supported collection values. Do not concatenate a String directly with an Object; use **write(payload, "application/json")** when JSON text is intended.
- **as** coerces values. For exactly two decimal places, use **200.1234 as String {format: "0.00"}**. Use **+** and **-** for numeric arithmetic; formatting a number produces a String.
- A **JSON object** is an Object value; JSON itself is a data format, not a replacement for Object or Array. A quoted JSON document can instead be a String until parsed with **read**.
- **XML output** needs a single document root. Build repeated child elements inside that root; XML multi-value selectors such as **payload.root.*item** can retrieve repeated siblings for mapping.
- **CSV output** commonly starts from an array of row objects, with keys supplying column names. The DataWeave output directive determines serialized bytes; naming a file **sales.csv** does not convert JSON into CSV.
HTTP, database and service connectors
HTTP configuration and SOAP consumption
- An **HTTP Listener** receives requests; an **HTTP Request** calls another endpoint. Shared Listener configuration defines protocol, host and port; individual sources define paths and allowed methods.
- Use **/customers/{customerId}** to capture a URI parameter. Configure explicit resource patterns and method restrictions, and check the incoming path against the Listener's base path and source path.
- Listeners can share one compatible global configuration on the same socket. The same path on different listening ports is distinct; separate servers attempting to bind the same address and port can conflict.
- Configure **method**, **path**, query parameters, headers and body independently on outbound requests. **405 Method Not Allowed** indicates that the target does not accept the selected method for that resource.
- **Web Service Consumer** invokes operations described by a **WSDL**. Build the operation's XML body with the expected element names and namespaces; a query parameter does not automatically become a SOAP body field.
- **SOAP** defines an XML messaging protocol and contracts; **HTTP** is a transport commonly used to carry SOAP. Diagnose **WSC:BAD_REQUEST** using the request structure, selected operation and service contract.
Database parameters and incremental polling
- A Database connector configuration needs the appropriate **JDBC driver**, connection URL, database and credentials. Package its driver dependency so the application can resolve it on every deployment target.
- **Select** returns an array of row objects, even when several rows match. Access column values through each row; use **sizeOf(payload)** for row count rather than relying on a Java implementation class name.
- Bind named SQL parameters with **:name** and supply an input-parameter object. For **WHERE city = :city AND state = :state**, provide an object with **city** and **state** keys and their values.
- **Insert**, **Update** and **Delete** perform changes; build their input maps from the event with DataWeave. Parameter binding separates SQL structure from values and avoids assembling SQL through string concatenation.
- **On Table Row** polls for rows. A **watermark** tracks an increasing value so later polls can fetch newer rows. Choose a reliably increasing ID or timestamp; a unique but unordered value such as a postal code can skip later inserts.
- A watermark is an incremental-selection mechanism, not a universal exactly-once guarantee. Design retries and downstream writes to tolerate replay and account for ties, updates and out-of-order arrivals.
Files, messaging and connector boundaries
- **File List** returns an array of Mule **messages**. Each file message has content in its payload and metadata such as name and size in attributes; a directory entry has an empty payload.
- A **File or FTP Read** reads content; it does not inherently delete or move the source. Configure explicit move, rename or delete behavior when the workflow requires it.
- **File Write** writes the supplied content using its configured path and write mode. Transform to the required media type before writing and handle connectivity or path failures through the connector's error types.
- **JMS Publish** sends a message without awaiting a business reply. **Publish Consume** implements request-reply and waits for a correlated response or timeout. A send can still fail even when no reply is expected.
- **Anypoint MQ FIFO** queues support ordered messaging and duplicate controls. Design consumers around acknowledgement, redelivery and idempotency; ordering and exactly-once business effects are separate concerns.
- Use **Mule SDK** for Mule 4 connector development. Application, connector, runtime and policy classloaders provide isolation, so dependency visibility must be declared rather than assumed.
Routing, iteration and batch processing
Conditional and concurrent routes
- **Choice** evaluates conditions in order and executes only the first matching route. The **default** route runs if none matches. A condition such as **#[payload.country == "FR"]** must evaluate to a Boolean.
- **Scatter-Gather** sends the same starting event to multiple routes concurrently and waits for their results. Elapsed time is approximately the longest route plus overhead, rather than the sum of route durations.
- Scatter-Gather returns an **Object keyed by route index**, with each value holding that route's message. Select the payloads explicitly when the desired output is an array of results.
- Scatter-Gather routes begin with the same variable values and cannot observe each other's changes while running. After aggregation, one modified value is retained; changes to the same variable in multiple routes are collected.
- An unhandled route failure leads to **MULE:COMPOSITE_ROUTING** after route processing. Handle a recoverable error inside its route when that route should contribute a fallback result.
- A recursive **Flow Reference** needs a reachable termination condition. Trace the changing payload or variable at each call; repeatedly calling the same branch without progress risks resource exhaustion.
Sequential iteration and record processing
- **For Each** processes collection items sequentially. Inside it, payload is the current item or configured group; after it completes, the original input payload remains. Variable updates can accumulate across iterations and remain available afterward.
- An unhandled error in **For Each** stops further iteration and reaches the enclosing error handler. **Parallel For Each** is a separate scope with different concurrency and result semantics.
- A **Batch Job** splits input into records, processes them through ordered **Batch Steps**, then runs **On Complete**. Record processing is asynchronous relative to the calling flow and can execute concurrently.
- Each batch record has its own payload and variables. Changes propagate to later steps for that record, not to other records or back to the calling event. Do not use one record's variable as a shared running total.
- A step's **acceptExpression** and **acceptPolicy** control eligibility. The default policy accepts records without previous failures; a failed record can reach a later step configured to accept failures.
- A record error does not inherently stop every record. **maxFailedRecords** can fail a job when the configured threshold is exceeded; acceptance filters and error handling determine subsequent record processing.
- A **Batch Aggregator** groups records for bulk operations. A fixed-size aggregator can emit a smaller final group; aggregation size differs from the internal record-block size used for execution.
- **On Complete** receives a batch result report with totals and success/failure counts. It does not receive an automatically collected array of transformed records. A Logger after the Batch Job is not proof that record processing has finished.
Error handling, debugging and deployment
Error handlers and response outcomes
- A Mule error has an **errorType**, description and cause; connector failures may include an error message. Types use namespaces, such as **FILE:CONNECTIVITY**. Match types rather than parsing exception text.
- Error handlers evaluate their entries in order and choose the first matching type and condition. Put specific cases before **ANY**. **Error mapping** can translate a connector error into an application type such as **ORDER:NOT_CREATED**.
- **On Error Continue** handles the failure and makes its owning flow or Try scope complete successfully. It does not resume at the processor immediately after the failure inside that same owner.
- **On Error Propagate** runs its handler and returns a failed outcome to the caller or enclosing scope. The caller can then select its own matching handler; later processors on the failed normal path are skipped.
- A **Try scope** creates a local error-handling boundary. If its handler continues, processing resumes after the Try. If it propagates, the enclosing handler takes over. A private flow can handle locally before the parent sees an error.
- A **subflow** relies on its caller's handling context. Reference a reusable global handler explicitly, or set **defaultErrorHandler-ref** on the application's **configuration** element for flows without their own handler.
- The **Validation module** throws typed errors when checks fail. **Is Number** validates numeric input; **Is Not Blank String** rejects blank text. Validation does not transform invalid data into a valid value.
- An HTTP Listener uses its normal response for successful handling and its error response for propagated failures. Defaults are **200** and **500**, respectively; explicitly configured status codes and bodies can override those defaults.
Debug, package and deploy
- Use **Studio breakpoints**, step controls and watch expressions to inspect the event. A breakpoint pauses before its processor executes; Logger output captures values when the Logger runs.
- Load settings with a global **configuration-properties** element. Nested YAML keys **training** and **host**, with correct indentation, are referenced as **${training.host}**. **#[...]** evaluates DataWeave instead of resolving a configuration placeholder.
- Keep flow XML under **src/main/mule** and resources under **src/main/resources**. **pom.xml** declares dependencies; **mule-artifact.json** describes the artifact and runtime requirements. Externalize environment settings and protect secrets.
- For a missing library, configure an accessible **Maven repository** or install the authorized artifact locally. An editable export needs **project metadata** and resolvable dependencies. Bundling dependencies increases size; omitting them requires the recipient to retrieve them.
- In the **CloudHub worker model**, one worker runs one application; an application can use multiple workers. **Horizontal scaling** adds workers; larger workers add capacity. **Runtime Manager** exposes deployment and application logs.
- For externally reachable **CloudHub HTTP**, bind to **0.0.0.0** and use **${http.port}** or **${https.port}**. The platform maps public traffic to the Listener. Local worker files are not dependable persistence across restarts.