BassemE/mulesoft-documentation-embeddings huggingface dataset:
avg | MuleSoft Documentation
# avg
## avg(values: Array<Number>): Number
Returns the average of numbers listed in an array.
An array that is empty or that contains a non-numeric value results in an error.
### Parameters
Name | Description  
---|---  
The input array of numbers.  
### Example
This example returns the average of multiple arrays.
#### Source
```
%dw 2.0
output application/json
---
{ a: avg([1, 1000]), b: avg([1, 2, 3]) }
```

#### Output
```
{ "a": 500.5, "b": 2 }
```
Certificate and Keystore Storage | MuleSoft Documentation
# Certificate and Keystore Storage
Certificates and keystores in Anypoint Partner Manager are securely stored in the Anypoint Platform secrets manager, which uses secure vault technology to store and control access to private keys, passwords, certificates, and other secrets.
For endpoints that use certificates or keystores, you can either select an available certificate or keystore that works with the endpoint type and protocol or upload a new one to Partner Manager.
## See Also
  * Managing Host Certificates
  * Managing AS2 Host Keystores
  * Managing Partner and Third-Party Connection Certificates
toDateOrNull | MuleSoft Documentation
# toDateOrNull
## toDateOrNull(str: String, formatters: Array<Formatter>): Date | Null
Transforms a `String` value into a `Date` value using the first `Formatter` that matches with the given value to transform.
If none of the `Formatter` matches with the given value, the function returns a `null` value.
_Introduced in DataWeave version 2.5.0._
### Parameters
Name | Type | Description  
---|---|---  
The `String` value to transform into a `Date` value.  
`formatters` | Array<Formatter> | The `array` of formatting to use on the `Date` value.  
### Example
This example shows how `toDateOrNull` behaves with different inputs. It produces output in the `application/dw` format.
#### Source
```
%dw 2.0
import * from dw::util::Coercions
output application/dw
---
{
 a: toDateOrNull("2023-28-03", [{format: "yyyy/MM/dd"}, {format: "yyyy-dd-MM", locale: "en_US"}]),
 b: toDateOrNull("2023-28-03", [{format: "yyyy/MM/dd"}])
}
```

#### Output
```
{
 a: |2023-03-28| as Date {format: "yyyy-dd-MM", locale: "en_US"},
 b: null
}
```
OAuth Module XML and Maven Support | MuleSoft Documentation
# OAuth Module XML and Maven Support
Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Studio.
If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Studio XML editor or from a text editor, you can get access to the connector in your app by adding reference statements to both your XML Mule flow and the Apache Maven `pom.xml` file.
When you add the connector in Studio, Studio automatically populates the XML code with the connector’s namespace and schema location. It also adds a dependency to the `pom.xml` file.
## Add a Namespace for the Connector
Paste the following code inside the `<mule>` tag of the header of your configuration XML:
```
http://www.mulesoft.org/schema/mule/oauth
http://www.mulesoft.org/schema/mule/oauth/current/mule-oauth.xsd
```

This example shows how the namespace statements are placed in the `<mule>` XML block:
```
<mule xmlns:oauth="http://www.mulesoft.org/schema/mule/oauth"
	xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
	xmlns:http="http://www.mulesoft.org/schema/mule/http"
	xmlns:file="http://www.mulesoft.org/schema/mule/file"
	xmlns="http://www.mulesoft.org/schema/mule/core"
	xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
	http://www.mulesoft.org/schema/mule/core/current/mule.xsd
	http://www.mulesoft.org/schema/mule/file
	http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
	http://www.mulesoft.org/schema/mule/http
	http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
	http://www.mulesoft.org/schema/mule/ee/core
	http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
	http://www.mulesoft.org/schema/mule/oauth
	http://www.mulesoft.org/schema/mule/oauth/current/mule-oauth.xsd">
```

## Add a POM File Dependency
The Apache Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app. If you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector:
```
<dependency>
 <groupId>org.mule.modules</groupId>
 <artifactId>mule-oauth-module</artifactId>
 <version>x.x.x</version>
 <classifier>mule-plugin</classifier>
</dependency>
```

Replace `x.x.x` with the version that corresponds to the connector you are using.
To obtain the most up-to-date `pom.xml` file information:
  1. Go to Anypoint Exchange.
  2. In Exchange, click **Login** and supply your Anypoint Platform username and password.
  3. In Exchange, search for `oauth module`.
  4. Select the connector.
  5. Click **Dependency Snippets** near the upper right of the screen.


## See Also
  * Introduction to Anypoint Connectors
  * MuleSoft Help Center
Developing Integrations | MuleSoft Documentation
# Developing Integrations
Cloud IDE 
Desktop IDE 
**Open Beta Release** : The **cloud IDE is in open beta**. Any use of Anypoint Code Builder in its beta state is subject to the applicable beta services terms and conditions, available from the IDE.
Use Anypoint Code Builder to build integrations within a Mule application. Integrations with Anypoint Code Builder rely on a service-based framework that decouples your source from protocols and routing requirements. You can reuse or change operations and processors in the application when your systems or business needs change.
Integrations enable multiple services to work as one. Some common use cases are:
  * Scheduling data processing
  * Connecting cloud and on-premises applications
  * Transforming message data to a required structure or format
  * Event processing in which multiple services are composed and operate simultaneously


After you create your integration project, you can optionally:
  * Work with code snippets.
  * Define and secure properties for your Mule application.
  * Trigger flows in your development environment.
  * Use the DataWeave language.
  * 

Other tasks you can do with your integration apps are:
  * Export Mule projects into a shareable or deployable JAR file.
  * Import project JAR files into a workspace in your IDE.
  * Deploy Mule apps to CloudHub.


## Source Control for Integration Projects
Use source control management (SCM) to store and share your design, integration, and implementation projects. For source control options, see Controlling Source Files.
Troubleshoot Anypoint VPN | MuleSoft Documentation
# Troubleshoot Anypoint VPN
These are some of the possible errors you may encounter when attempting to connect Anypoint VPN.
## Unable to Connect to the Anypoint VPN
If you are unable to connect to the Anypoint VPN, ensure any firewalls that are configured are allowing traffic through the IP addresses in the `localExternalIpAddress` field in the VPN tunnels.
## Routes are Not Present in the VPC Route Table
The VPC route table is not updated until the tunnels are active. When using static routing, the remote networks are added to the route table when the tunnel is active, and removed when the tunnel is inactive. This is the expected behavior. When using BGP routing, the routes are propagated from your VPN endpoint when the tunnel is active. If the route table does not show the required entries, ensure that the BGP session is active and validate the BGP configuration on your device.
## Anypoint VPN Tunnel Connection Works, but Routes are not Propagated
Ensure that the neighbor IP address for the tunnel is taken from the Local point-to-point IP address in the tunnel’s details.
## Phase 2 SA Established, but Traffic not Passing Through Tunnel
The VPN connection supports only one security association (SA) pair per tunnel, so any more than one traffic selector per connection will cause unexpected results.
To solve this, ensure that only one unique SA is used per VPN tunnel connection. If more than one policy is needed, you must consolidate and filter traffic in your network.
## Anypoint VPN Tunnel Disconnects After Period of Inactivity
IPsec is established by sending "interesting traffic" (traffic that should be encrypted over the Anypoint VPN connection). If there is no interesting traffic, the tunnel disconnects. This is the expected behavior, and the timeout value might vary.
Some VPN configurations require additional steps to keep the tunnel active, which means you need to ensure you periodically send interesting traffic. For example, sending ICMP requests every 5 seconds to a CloudHub worker’s internal IP address or FQDN will keep the tunnel active.
## Tunnel Status in the Runtime Manager UI Shows the Wrong Value
Because the time to retrieve the tunnel status includes the inherent delay in the infrastructure-provider API, you can expect delays of up to five minutes when reporting the correct status. Do not use this information to trigger a failover between the tunnels. Instead, monitor tunnels at the customer-side VPN gateway.
## See Also
  * Anypoint VPN Knowledge Articles Main Page
Shared Spaces | MuleSoft Documentation
# Shared Spaces
A _shared space_ is an elastic cloud of resources that includes Mule instances running in a multi-tenant environment. CloudHub 2.0 provides one shared space in each supported region, to which you deploy your integration applications.
Deploying to a shared space requires no setup or maintenance of the underlying infrastructure.
You can deploy apps to the shared space in a region if:
  * You don’t require isolation from the public cloud.
  * Your apps don’t need to connect to an on-premises data center.
  * Your apps can use the `cloudhub.io` domain name (rather than a vanity domain name).
  * You don’t need to configure custom certificates.


Any of the following features and functionality requires a private space:
  * Single-tenancy for your apps
  * Network connection (VPN or transit gateway attachment) to a data center
  * Vanity domain names
  * Custom certificates
  * Private endpoints
  * Static application source IP addresses


## See Also
  *
X12 EDI Connector 2.15 | MuleSoft Documentation
# X12 EDI Connector 2.15
Support Category: Premium
Anypoint Connector for X12 EDI (X12 EDI Connector) enables you to convert X12 messages to and from DataWeave-compatible representations by using lists and maps. All of the schema definitions you need for supported X12 standard transaction sets are included. For complete information about schemas, see X12 EDI Schema Language Reference.
Many Health Insurance Portability and Accountability Act (HIPAA) document versions are also supported, as listed separately in the Supported HIPAA Versions. For more information about HIPAA usage, refer to Connector HIPAA Standards.
## Prerequisites
To use this connector, you must be familiar with:
  * Anypoint Connectors
  * Mule runtime engine (Mule)
  * Elements and global elements in a Mule flow
  * Creating a Mule app using Anypoint Studio (Studio)


Before creating an app, you must have:
  * Purchased a MuleSoft license for X12 EDI Connector.
Contact your Account Representative about purchasing a license.
  * Anypoint Studio 7.0 or later


X12 EDI Connector supports files of up to 15 MB in size, and the memory requirement is approximately 40 to 1. For example, a 1 MB file requires up to 40 MB of memory to process, so it’s important to consider this memory requirement in conjunction with your Transactions Per Second (TPS) needs for large X12 files. This is not an exact figure; the value varies according to the complexity of the mapping instructions.   
---  
## Exchange Templates and Examples
Anypoint Exchange provides templates that you can use as starting points for your apps and examples that illustrate a complete solution.
### X12 EDI Connector Templates in Exchange
X12 EDI Connector templates provide starting points that help you:
  * Map application messages to outbound X12 transactions 
  * Map inbound X12 transactions to the application message format
  * Set up your Partner Manager content storage


### X12 EDI Connector Examples in Exchange
X12 EDI Connector examples in Exchange enable you to:
  * Customize an X12 EDI schema for B2B integrations
  * Transform outbound purchase order XML messages to X12 850 transactions
  * Transform inbound X12 850 transactions to JSON purchase orders
  * Transform outbound XML messages into X12 purchase orders, inbound X12 purchase orders into JSON, and generate a functional acknowledgement
  * Implement an end-to-end order to cash workflow from the perspective of a seller
  * Implement an end-to-end B2B procure to pay workflow from the perspective of a buyer


## Next Step
After you complete the prerequisites, you are ready to create your own app and configure the connector using Anypoint Studio.
## See Also
Introduction to Anypoint Connectors
Use Exchange to Discover Connectors, Templates, and Examples
MuleSoft Help Center
Collecting Mule Gateway Metrics | MuleSoft Documentation
# Collecting Mule Gateway Metrics
Mule Gateway is enabled, by default, to collect relevant usage data for improving user experience. MuleSoft uses this data to analyze and better understand the Mule Gateway capabilities uniformly for all customers. The metrics collected by Mule Gateway include:
  * Number and types of applications, APIs, and policies deployed
  * Mule Gateway-related configuration parameters
  * Statistics about the number of requests processed


Note that sensitive information, such as credentials and policy configuration parameters, is not collected. This feature is included in the 3.9.5, 4.2.2, and 4.3.0 versions of Mule runtime engine.
## Disable Mule Gateway Metrics Collection
Even though no sensitive information is collected using this configuration, you might still want to disable it for some reason. To disable the configuration, add the following entry in the `wrapper.conf` file:
`anypoint.platform.metrics_enabled=false`
## Log Analytics Event Data
Mule Gateway provides `INFO` API analytics event logging to capture data about incoming API requests.
API analytics event logging is only supported in Mule runtime versions 4.4.x and 4.5.x released after Feb 1, 2024 and Mule runtime versions 4.6.0 and later.   
---  
By default, `anypoint.platform.log_analytics_events=false`. Enable event logging by adding the following entry to the `wrapper.conf` file:
```
anypoint.platform.log_analytics_events=true
```

Due to additional log generation, events logging might affect the performance of the request processing.   
---  
Logs appear in the following format:
```
com.mulesoft.mule.runtime.gw.analytics.logger.AnalyticsHttpEventsLogger: {"api_id":XX,"api_version_id":XX,"org_id":"XXX","host_id":"XXXX","client_id":XXX,"transaction_id":XXX,"received_ts":"XXX","replied_ts":"XXX","client_ip":"XX","verb":"GET","path":"/backend","status_code":200,"user_agent":"XXX","request_bytes":0,"response_bytes":150,"request_disposition":"XXX","policy_violation":null,"event_id":"XXX","deployment_type":null}
```

## Manage Logs and Troubleshoot
If an error occurs during the metrics collection process, your Mule application’s ability to complete other tasks is not affected. Additionally, all entries related to the metrics collection is logged as `DEBUG` in the following packages to avoid cluttering the log files:
  * In Mule 3 runtimes:
    * `com.mulesoft.module.client.metrics`
    * `com.mulesoft.module.metrics`
  * In Mule 4 runtimes,`com.mulesoft.mule.runtime.gw.metrics`


If you encounter issues with this feature:
  1. Contact MuleSoft Support and supply them with the metrics logs listed in the previous section.
  2. Disable the configuration until Support is able to resolve your issue.
Anypoint DataGraph Administration | MuleSoft Documentation
# Anypoint DataGraph Administration
You manage Anypoint DataGraph in API Manager. The DataGraph Administration page for a given environment appears only after you have added at least one API schema to that environment’s unified schema.
Both Anypoint DataGraph administrators and contributors can:
  * Use the Anypoint DataGraph Administration settings to select environments, view and edit the GraphQL endpoint of a unified schema, configure policies, and configure client providers.
  * Manage contracts to ensure that only authorized client applications can consume the unified schema.
  * Manage SLA tiers for each Anypoint DataGraph instance.
  * Use the API Manager Client Applications page to view and manage client application contracts.


## See Also
  * Anypoint DataGraph Overview
Group | MuleSoft Documentation
# Group
Using the _Group_ block gives you a clearer overview when designing your Workflows. It provides delineation both graphically and in terms of content within a Workflow. For example, you can easily use it to group action step variables.
You can, however, also use all other action steps. A couple of exceptions are the _Transaction_ action step and the _Workflow Initialization_ element. It is possible to position multiple _Group_ blocks inside each other.
The _Group_ block does **not** restrict the availability of variables in subsequent transactions such as the _Transaction_ action step, for example.
## Properties
The _Group_ block has no properties.
## Inbound Variables
The _Group_ block possesses no inbound variables.
## Outbound Variables
The _Group_ block possesses no outbound variables.
Troubleshooting Linux Permissions | MuleSoft Documentation
# Troubleshooting Linux Permissions
To help limit access to information about a Flex Gateway, the following `flexctl` commands can be executed on Linux deployments only by the root user and by users in the `flex` user group:
  * `flexctl dump`
  * `flexctl version`
  * `flexctl check connections`
  * `flexctl probe`
  * `flexctl registration inspect` (when executed without the `--file` flag)


There are two options to execute these commands:
  * Add the User to the Flex User Group
  * Run as the Root User


## Add the User to the Flex User Group
Adding a user to the `flex` user group is a permanent solution and requires no action after the user is added. Execute the following command to add the current user to the `flex` user group:
```
sudo usermod -a -G flex $USER
```

After running the command, the user must log in to the VM again to begin using the `flexctl` commands.
## Run as the Root User
Executing the `sudo` command with your `flexctl` command is the quickest way to access Flex Gateway information. However, you must execute the `sudo` command every time you run a `flexctl` command if the user is not part of the `flex` user group:
```
sudo flexctl <command>
```

When the `sudo flexctl dump` command is executed, the root user is the owner of the created dump files. If the current user is not the root user, the user cannot view the dumped files. To view the files, execute the following command to change the owner of the files:
```
sudo chown $USER *.json
```

## See Also
  * Troubleshooting with the CLI
Email Connector | MuleSoft Documentation
# Email Connector
Email Connector v1.1
Anypoint Connector for Email (Email Connector) sends and retrieves email messages over standard email protocols. Its main features include:
  * Retrieving emails from POP3 mailboxes
  * Retrieving, deleting, and storing emails from IMAP mailboxes
  * Sending emails over the SMTP protocol
  * Supporting secure connections for all protocols over Transport Layer Security (TLS)


## Connector Configurations
Email Connector configurations vary depending on the protocol you use. They share a basic set of parameters that require a connection over the protocols described in this documentation.
## TLS Configuration with Keystores and Truststores
You can use Transport Layer Security (TLS) and configure email by providing a key store with your certificate. You can also enable 2-way authentication by providing a trust store. For details, see Configure TLS with Keystores and Truststores.
## POM File Information
```
<dependency>
 <groupId>org.mule.connectors</groupId>
 <artifactId>mule-email-connector</artifactId>
 <version>x.x.x</version>
 <classifier>mule-plugin</classifier>
</dependency>
```

Replace `x.x.x` with the version that corresponds to the connector you are using. To specify a version, view Email Connector in Anypoint Exchange and click **Dependency Snippets**.
## See Also
  * Email Connector Release Notes
  *   * Email Connector Reference
  * Listing Emails with the Email Connector
  * Sending Emails with the Email Connector
  * Connecting with Gmail
  * MuleSoft Help Center
Share Applications | MuleSoft Documentation
# Share Applications
When working on a team, a Mule runtime engine project increases in size, increases in its number of developers who need to collaborate, and the need to run the project in both test and production environments. However, you can offset this project growth by sharing applications.
Sharing applications is an opportunity for splitting work across teams, whether these teams work on the same overarching project or on different projects that they intent for reuse. Because applications are stored in self-contained archives, they can be shared via a simple file or web server.
To share applications, follow these steps:
  1. Document the name and content of the properties file that each application is expecting to use. The administrators who deploy and run the Mule application can encrypt the properties file as detailed in Secure Configuration Properties. Administrators must keep the decryption key of the properties file secure.


  2. Generate the file used to share the application in one of the following two ways:
     * Export the application from Anypoint Studio and generate a deployable archive `.jar` file.
     * Package your application into one of the following three types of `.jar` files using the Mule Maven Plugin:
       * Deployable archive `.jar` file to deploy into a running Mule runtime engine.
       * Mule app package `.jar` file to import into Studio.
       * Mule app lightweight package `.jar` file to then import it into Studio.


  3. Share the `.jar` file with other developers, as appropriate.


## See Also
  * Exporting Projects from Studio
  * Mule Application Packaging
Process Monitoring | MuleSoft Documentation
# Process Monitoring
The **Process Monitoring** module displays the execution of your processes in real time.
In the **Bot State and Operation** view, you see the current status, the current deployment, and the number of completed tasks of each Bot.
In the **Process Streaming** view, you see the number of configurations, RPA Bots, and sessions for each productive process. You can open a live view of the sessions of a process and watch the bot as it works.
In the **Session Queues** view, you see the order of the process runs. The processes are queued according to their priority.
## See Also
  *   * Queueing Process Sessions
The Toolbox | MuleSoft Documentation
# The Toolbox
The Toolbox contains all action steps that you can configure to add logic to the tasks in your process automations. All actions are grouped in different containers and the documentation follows the same order as they appear in the RPA Builder UI.
  *   *   *   *   *   *   *   *   *   *
toDegrees | MuleSoft Documentation
# toDegrees
## toDegrees(angrad: Number): Number
Converts an angle measured in radians to an approximately equivalent number of degrees.
_Introduced in DataWeave version 2.4.0._
### Parameters
Name | Description  
---|---  
Number of radians to convert to degrees.  
### Example
This example shows how `toDegrees` behaves with different inputs.
#### Source
```
%dw 2.0
import * from dw::util::Math
output application/json
---
{
 "toDegrees0.17": toDegrees(0.174),
 "toDegrees0": toDegrees(0),
 "toDegrees-20": toDegrees(-0.20)
}
```

#### Output
```
{
  "toDegrees0.17": 9.969465635276323832571267395889251,
  "toDegrees0": 0E+19,
  "toDegrees-20": -11.45915590261646417536927286883822
 }
```
URL (dw::core::URL) | MuleSoft Documentation
# URL (dw::core::URL)
This module contains helper functions for working with URIs.
To use this module, you must import it to your DataWeave code, for example, by adding the line `import * from dw::core::URL` to the header of your DataWeave script.
## Functions
Name | Description  
---|---  
Uses a custom string interpolator to replace URL components with a `encodeURIComponent` result. You can call this function using the standard call, or a simplified version.  
Decodes the escape sequences (such as `%20`) in a URI.  
| Decodes a Uniform Resource Identifier (URI) component previously created by `encodeURIComponent` or a similar routine.  
Encodes a URI with UTF-8 escape sequences.  
| Escapes certain characters in a URI component using UTF-8 encoding.  
Parses a URL and returns a `URI` object.
Deploying the American Flights App | MuleSoft Documentation
# Deploying the American Flights App
Cloud IDE 
Desktop IDE 
**Open Beta Release** : The **cloud IDE is in open beta**. Any use of Anypoint Code Builder in its beta state is subject to the applicable beta services terms and conditions, available from the IDE.
Deploy the American Flights application to CloudHub. After deploying to CloudHub, manage your application through Anypoint Runtime Manager.
Anypoint Code Builder deploys Mule applications to the non-production **Sandbox** environment in CloudHub.
## Before You Begin
Complete these procedures:
  1. Designing the American Flights API Spec
  2. Integrating American Flights Processes
  3. Implementing the American Flights API Spec
  4. Debugging the American Flights App
  5. Log in to Anypoint Platform from the IDE. If you do not log in, the IDE prompts you to log in when an operation that you perform requires authentication. You can follow the prompts in the UI to complete the login process when prompted.


## Deploy an Application to CloudHub
  1. Open your project in Anypoint Code Builder.
  2. Click the (**Deploy to CloudHub**) icon when your configuration XML file is open, for example:
Alternatively, open the Command Palette by pressing Cmd+Shift+p (Mac) or Ctrl+Shift+p (Windows), and provide this command:
```
MuleSoft: Deploy to CloudHub
```

  3. If prompted, sign in to Anypoint Platform.
  4. When prompted, click **Deploy**.
Anypoint Code Builder creates and opens a deployment file (`deploy.json`) for your review, for example:
```
{
 "runtime": "4.4.0",
 "workerSize": 0.1,
 "applicationName": "american-ws-anypoint-code-builder"
 "workers": 1,
 "autoStart": true
}
```

     * The `applicationName` property defines part of the URL for accessing your application on CloudHub.
     * The name must be unique across all applications deployed to your business group in CloudHub.
     * The `runtime` version is the Mule runtime version you select when creating the integration.
For information about version support and automated Mule patch updates, see Mule and Java version support.
  5. After reviewing the deployment configuration, click **Deploy** to deploy the application to CloudHub:
  6. Select the **Sandbox** environment:
Other environments are not supported.
Anypoint Code Builder packages and deploys the application to CloudHub.
  7. After deployment completes, select **Open in Runtime Manager**.
  8. Select your application from the list applications.
  9. Check the domain name for your application and, optionally, test the application.
For example, the name of the American Flights example on the EU cloud is similar to `american-ws-anypoint-code-builder.eu-s1.cloudhub.io`. To start the example, open your REST client or browser, and make a GET request to the URI, for example: `http://american-ws-anypoint-code-builder.eu-s1.cloudhub.io/api/flights`
Run Custom Event Processor | MuleSoft Documentation
# Run Custom Event Processor
Anypoint Code Builder 
Anypoint Studio 
The **Run Custom event processor** enables you to assert the Mule event content against a custom assertion.
To add the **Run Custom processor** to your project, add the following dependency to your `pom.xml` file:
```
<dependency>
  <groupId>com.mulesoft.munit</groupId>
  <artifactId>munit-assert</artifactId>
  <version>${munit.version}</version>
  <scope>test</scope>
</dependency>
```

You also have to add your custom assertion class to the `mule-artifact.json` file as an exported resource.
For example, you can define the following assertion in Java:
```
package org.mule.custom;
import org.mule.munit.assertion.api.MunitAssertion;
import org.mule.munit.assertion.api.TypedValue;
public class CustomAssertion implements MunitAssertion {
  @Override
  public void execute(TypedValue expression, Object params) throws AssertionError { **(1)**
    if (!"Hello World".equals(expression.getValue())) { **(2)**
      throw new AssertionError("Error the payload is incorrect");
    }
   }
}
```

Implement the only method in the interface `public void execute(TypedValue expression, Object params) throws AssertionError`.  
---  
Run your custom logic, which in this case validates that the message payload is `Hello World`.  
The `CustomAssertion` class must be located in the scr/test/java directory.
And use the **Run Custom Event Processor** to run it:
```
<munit-tools:run-custom
 assertion="org.mule.custom.CustomAssertion" **(1)**
 expression="#[payload]"/>
```

The assertion field needs to have the canonical class name of your custom assertion and the class needs to be exported.  
---  
To export it when packaging your application, add the `org.mule.custom` package to your `mule-artifact.json`
```
{
  "name": "mule-application",
  "minMuleVersion": "4.2.0",
  "classLoaderModelLoaderDescriptor": {
    "id": "mule",
    "attributes": {
      "exportedPackages": [
        "org.mule.custom"
      ]
    }
  }
}
```

You only need to configure the package name in the `exportedPackages` collection.   
---  
## See Also
  *   * Assert That Event Processor
  * Set Event Processor
  * Mock When Event Processor
  * Verify Event Processor
  * Fail Event Processor
Prerequisites for MuleSoft Accelerator for Manufacturing | MuleSoft Documentation
# Prerequisites for MuleSoft Accelerator for Manufacturing
This page provides a summary of the guides available for configuring the various systems and products required to implement the use cases provided by this solution. The individual systems needed, and amount of configuration required, depend on which assets are to be deployed in your target environment(s) - refer to the use case pages for more details.
## Available Guides
The following setup and configuration guides are available for this accelerator:
  * Accelerator Setup Guide
  *   * OSISoft PI Setup Guide for Productive Maintenance
  * SAP S4HANA Setup Guide for Sales Rebate Management
  * Tableau Setup Guide for Productive Maintenance


Most of the implementation templates also contain details on requirements specific to those applications.
## See Also
  *   * MuleSoft Accelerator for Manufacturing
firstWith | MuleSoft Documentation
# firstWith
## firstWith<T>(array: Array<T>, condition: (item: T, index: Number) -> Boolean): T | Null
Returns the first element that satisfies the condition, or returns `null` if no element meets the condition.
_Introduced in DataWeave version 2.3.0._
### Parameters
Name | Description  
---|---  
The array of elements to search.  
`condition` | The condition to satisfy.  
### Example
This example shows how `firstWith` behaves when an element matches and when an element does not match.
#### Source
```
%dw 2.0
output application/json
import firstWith from dw::core::Arrays
var users = [{name: "Mariano", lastName: "Achaval"}, {name: "Ana", lastName: "Felisatti"}, {name: "Mariano", lastName: "de Sousa"}]
---
{
 a: users firstWith ((user, index) -> user.name == "Mariano"),
 b: users firstWith ((user, index) -> user.name == "Peter")
}
```

#### Output
```
{
 "a": {
  "name": "Mariano",
  "lastName": "Achaval"
 },
 "b": null
}
```

## firstWith(array: Null, condition: (item: Nothing, index: Nothing) -> Any): Null
Helper function that enables `firstWith` to work with a `null` value.
_Introduced in DataWeave version 2.4.0._
Troubleshooting Connectivity or System-Related Errors | MuleSoft Documentation
# Troubleshooting Connectivity or System-Related Errors
If you have problems receiving or sending data, the messages and solutions described here can help resolve your issue.
Changing the Most Important System Parameters with One Setting | MuleSoft Documentation
# Changing the Most Important System Parameters with One Setting
_Windows_ has a general performance setting for visual effects that will turn off all settings relating to picture search at the same time. We **strongly recommend** adjusting this setting for all client systems and all systems used to create _Workflow_ s. Simply go to System Properties on the tab Advanced.
If not selected, switch to the _Visual Effects_ tab and set the radio button to _Adjust for best performance._
Add SLA Tiers for Anypoint DataGraph | MuleSoft Documentation
# Add SLA Tiers for Anypoint DataGraph
Add multiple SLA tiers to an Anypoint DataGraph instance to control user access and limit requests.
To add an SLA tier:
  1. Navigate to **Anypoint Platform** > **API Manager**.
  2. Click **DataGraph Administration** > **SLA Tiers** :
  3. From the DataGraph SLA Tiers page, click **Add SLA tier** :
  4. In the **# of Reqs** field, add the number of requests a client can make, for example, `100`.
  5. In the **Time Period** field, specify a timeout before a client request fails, for example, `60`.
  6. In the **Time Unit** field, select the unit of time from the drop-down list, for example, `Seconds`.
  7. If you want to display the SLA tier with the contract, select **Visible** .
  8. If you want to create additional SLA tiers, click **Add Limit**.
  9. Click **Add**.


## See Also
  * Anypoint DataGraph Overview
  * Reviewing SLA Tiers Concepts on API Manager
Apache Kafka Connector 4.4 | MuleSoft Documentation
# Apache Kafka Connector 4.4
Anypoint Connector for Apache Kafka (Apache Kafka Connector) enables you to interact with the Apache Kafka messaging system and achieve seamless integration between your Mule app and a Kafka cluster, using Mule runtime engine (Mule).
For compatibility information see the Apache Kafka Connector Release Notes.
## Before You Begin
Before creating an app, you must:
  * Have access to the Apache Kafka target resource and Anypoint Platform
  * Understand how to create a Mule app using Anypoint Studio
  * Have access to Apache Kafka to get values for the fields that appear in Studio


## Use Cases
Apache Kafka is a multipurpose application. Integration with Apache Kafka relies on the applications that are typically used with it.
Example use cases include:
  * An integration application that ensures that patients in a hospital receive the care they need in a timely manner An example of this is a hospital server that processes emergency requests for patient admissions. The requests are ordered by priority determined by specified criteria, such as how critical the patient’s condition is and the staff that is available to treat the patient. In this scenario, an application processes Apache Kafka messages in the order that they are received, relying on the order and idempotency of the messages sent through the queue.
  * An application that is time-sensitive An example is a newsroom that uses the Apache Kafka system to deliver the latest news. To retrieve the latest news, reading from the Apache Kafka queue sometimes requires reading from the end of the queue first.
  * Multiple applications that rely on the information provided by Apache Kafka For example, a department store uses a website activity tracker to improve the online shopping experience. The data that is gathered is sent to multiple departments for various computations. Each department reviews the information that’s received to stay informed about what the customer is looking for and then provides recommendations accordingly.


## Audience
  * Starting user
To create a Mule app, see Apache Kafka Studio Configuration.
  * Power user
Read XML and Maven Support and Examples.


## Next
After you complete the prerequisites, you are ready to create an app with Anypoint Studio.
## See Also
  * Introduction to Anypoint Connectors
  * Use Exchange to Discover Connectors, Templates, and Examples
  *   * MuleSoft Help Center
Objects (dw::core::Objects) | MuleSoft Documentation
# Objects (dw::core::Objects)
This module contains helper functions for working with objects.
To use this module, you must import it to your DataWeave code, for example, by adding the line `import * from dw::core::Objects` to the header of your DataWeave script.
## Functions
Name | Description  
---|---  
Breaks up an object into sub-objects that contain the specified number of key-value pairs.  
Returns an array of key-value pairs that describe the key, value, and any attributes in the input object.  
Returns `true` if every entry in the object matches the condition.  
Returns an array of key names from an object.  
Appends any key-value pairs from a source object to a target object.  
Returns an array of keys from an object.  
Returns `true` if at least one entry in the object matches the specified condition.  
Selects key-value pairs from the object while the condition is met.  
Returns an array of the values from key-value pairs in an object.
Zuora Connector 6.0 | MuleSoft Documentation
# Zuora Connector 6.0
Anypoint Connector for Zuora (Zuora Connector) enables access to the Zuora platform. This connector exposes all of the operations provided by Zuora’s REST API.
For information about the Zuora REST API methods and parameters, see the Zuora REST API Reference.
For compatibility information and fixed issues, see the Zuora Connector Release Notes.
## Before You Begin
To use this connector, you must be familiar with:
  * The Zuora API
  * Anypoint Connectors
  * Mule runtime engine (Mule)
  * Elements and global elements in a Mule flow
  * How to create a Mule app using Anypoint Studio (Studio)


Before creating an app, you must have access to the Zuora target resource.
## Audience
  * New user
    * Create your Mule app in Anypoint Studio.
  * Advanced user, read:
    * XML and Maven Support
    * Zuora Connector Examples


## Next Step
After you complete the prerequisites, you are ready to create an app in Anypoint Studio.
## Authentication Types
Zuora Connector connections use the following authentication types:
  * Basic authentication Uses a username and password for authentication
  * OAuth 2.0 Delegates user authentication to the service hosting the user account


## See Also
  * Introduction to Anypoint Connectors
  * Use Exchange to Discover Connectors, Templates, and Examples
  * Zuora Connector Reference
  * MuleSoft Help Center
mod | MuleSoft Documentation
# mod
## mod(dividend: Number, divisor: Number): Number
Returns the modulo (the remainder after dividing the `dividend` by the `divisor`).
### Parameters
Name | Description  
---|---  
The number that serves as the dividend for the operation.  
The number that serves as the divisor for the operation.  
### Example
This example returns the modulo of the input values. Note that you can also use the `mod(dividend, divisor)` notation (for example, `mod(3, 2)` to return `1`).
#### Source
```
%dw 2.0
output application/json
---
[ (3 mod 2), (4 mod 2), (2.2 mod 2) ]
```

#### Output
filterObjectLeafs | MuleSoft Documentation
# filterObjectLeafs
## filterObjectLeafs(value: Any, criteria: (value: Any, path: Path) -> Boolean): Any
Applies a filtering expression to leaf or `Path` values of keys in an object.
The leaf values in the object must be `SimpleType` or `Null` values. See Core Types for descriptions of the types.
_Introduced in DataWeave version 2.4.0._
### Parameters
Name | Description  
---|---  
An input value of `Any` type.  
Boolean expression to apply to `SimpleType` or `Null` leaf values of all objects in the input `value`. If the result is `true`, the object retains the leaf value and its key. If not, the function removes the leaf value and key from the output.  
### Example
This example shows how `filterObjectLeafs` behaves with different inputs.
#### Source
```
%dw 2.0
import * from dw::util::Tree
var myArray = [{name @(mail: "me@me.com", test:123 ): "", id:"test"},
        {name: "Me", id:null}]
output application/json
---
{
 a: {
   name: "Mariano",
   lastName: null,
   age: 123,
   friends: myArray
  } filterObjectLeafs ((value, path) ->
     !(value is Null or value is String)),
 b: { c : null, d : "hello" } filterObjectLeafs ((value, path) ->
     (value is Null and isObjectType(path)))
}
```

#### Output
```
{
 "a": {
  "age": 123,
  "friends": [
   {
   },
   {
   }
  ]
 },
 "b": {
  "c": null
 }
}
```
FTPS Connector | MuleSoft Documentation
# FTPS Connector
Anypoint Connector for FTPS (FTPS Connector) connects to FTP servers the same way as the FTP Connector but adds support for Transport Layer Security (TLS).
## Before You Begin
To use this connector, you must be familiar with:
  * Anypoint Connectors
  * Mule runtime engine (Mule)
  * Elements and global elements in a Mule flow
  * Creating a Mule app using Anypoint Studio (Studio)


Before creating an app, you must have access to Anypoint Platform and Anypoint Studio.
## See Also
  * FTPS Connector Reference
  * MuleSoft Help Center
Force Error State | MuleSoft Documentation
# Force Error State
Forces the _Workflow_ into an error state and writes the error message to the `Error Out` workflow variable.
If you don’t handle this error within a _Managed Block_ , the _Workflow_ aborts at this point and returns with an error.
## Properties
  * **Error Message**
Custom error message to write into the `Error Out` workflow variable.
If this field is not set, the action step outputs `Workflow error state manually forced by action step! [No custom message was set.]`


## Inbound Variables
  * **Error Message**


## Outbound Variables
This action step has no outbound variables.
Validating Query Parameters and Headers | MuleSoft Documentation
# Validating Query Parameters and Headers
Configure **APIkit Router** to validate headers and query parameters, restricting them to the attributes specified within your API specification.
  1. In Studio, select **APIkit Router**.
  2. Click **Edit** for your router configuration.
  3. Select **Query Parameters Strict Validations** to restrict the usage of query parameters to the ones defined in your API specification.
  4. Select **Headers Strict Validations** to limit the headers to the ones specified in your API specification.


You can also configure **APIkit Router** to validate headers and query parameters by updating the APIkit configuration code as follows:
```
<apikit:config name="api-config"
        api="api.raml"
        outboundHeadersMapName="outboundHeaders"
        httpStatusVarName="httpStatus"
        queryParamsStrictValidation="true"
        headersStrictValidation="true" />
```

## Disable Validation of Query Parameters and Headers
Disable the validation of query parameters and headers to minimize latency.
  1. In Studio, select **APIkit Router**.
  2. Click **Edit** for your router configuration.
  3. Select **Disable Validations**.


You can also disable the validation of query parameters and headers to minimize latency by updating the APIkit configuration code as follows:
```
<apikit:config name="api-config"
        api="api.raml"
        outboundHeadersMapName="outboundHeaders"
        httpStatusVarName="httpStatus"
        disableValidations="true" />
```

## See Also
  * Configuring the Response Headers and Status Code
  * Configure the Service URI
JSON Module | MuleSoft Documentation
# JSON Module
JSON Module v2.3
The JSON module provides extra functionality for processing JSON documents. Although DataWeave is the tool that Mule uses to access data in JSON documents, this module provides extra functionality that falls outside of DataWeave’s scope, like schema validation.
Release Notes: JSON Module Release Notes Exchange: JSON Module
## See Also
  * ValidateDocuments against a JSON Schema with the JSON Module
  * JSON Module Reference
  * MuleSoft Help Center
SAP S/4HANA OData Connector 2.9 | MuleSoft Documentation
# SAP S/4HANA OData Connector 2.9
Anypoint Connector for SAP S/4HANA OData (SAP S/4HANA OData Connector) provides support for the OData APIs exposed by SAP S/4HANA Cloud and SAP S/4HANA on-premise.
The connector enables you to perform operations to:
  * Create, get, update, and delete entities
  * Retrieve a single entity
  * Query multiple entities
  * Invoke a remote function
  * Execute batch requests that consist of multiple requests


For software requirements and compatibility information, see the SAP S4/HANA Connector Release Notes.
## Before You Begin
To use this connector, you must be familiar with:
  * The SAP S/4HANA OData API
  * Anypoint Connectors
  * Mule runtime (Mule)
  * Elements and global elements in a Mule flow
  * Creating a Mule app using Anypoint Studio (Studio)


Before creating an app, you must have:
  * Credentials to access the SAP S/4HANA OData target resource
  * Anypoint Platform
  * Anypoint Studio 7.3 or later
  * Have a developer account or other valid SAP S/4HANA instance
  * Access to the catalog service that allows you to use the service discovery
  * A communication user that is assigned to the corresponding communication arrangements for the desired APIs


## Common Use Case for the Connector
Perform CRUD operations on entity types of SAP S/4HANA’s OData API and process the response.
## Exchange Templates and Examples
Anypoint Exchange provides templates you can use as a starting point for your app, as well as examples that illustrate a complete solution.
## Next Step
After you complete the prerequisites and experiment with templates and examples, you are ready to create an app with Anypoint Studio.
## See Also
  * Introduction to Anypoint Connectors
  * SAP S/4HANA OData Connector Release Notes
  * SAP S/4HANA OData Connector on Exchange
  * MuleSoft Help Center
charCode | MuleSoft Documentation
# charCode
## charCode(text: String): Number
Returns the Unicode for the first character in an input string.
For an empty string, the function fails and returns `Unexpected empty string`.
### Parameters
Name | Description  
---|---  
The input string.  
### Example
This example returns Unicode for the "M" in "Mule".
#### Source
```
%dw 2.0
import * from dw::core::Strings
output application/json
---
{
 "charCode" : charCode("Mule")
}
```

#### Output
```
{ "charCode" : 77 }
```

## charCode(text: Null): Null
Helper function that enables `charCode` to work with a `null` value.
_Introduced in DataWeave version 2.4.0._
Microsoft Dynamics 365 Business Central Connector 1.0 | MuleSoft Documentation
# Microsoft Dynamics 365 Business Central Connector 1.0
Anypoint Connector for Microsoft Dynamics 365 Business Central (Microsoft Dynamics 365 Business Central Connector) enables you to manage entities for your companies in Microsoft Dynamics 365 Business Central.
For information about compatibility and fixed issues, refer to the Microsoft Dynamics 365 Business Central Connector Release Notes.
## Before You Begin
To use this connector, you must be familiar with:
  * The Microsoft Dynamics 365 Business Central API
  * Anypoint Connectors
  * Mule runtime engine (Mule)
  * Elements and global elements in a Mule flow
  * How to create a Mule app using Anypoint Studio


Before creating an app, you must have:
  * Credentials to access the Microsoft Dynamics 365 Business Central target resource
  * Anypoint Platform
  * Anypoint Studio version 7.3.5 or later


## Common Use Cases for the Connector
Some common use cases for Microsoft Dynamics 365 Business Central Connector include:
  * Viewing sales order statuses on an account
  * Creating a Business Central sales order when an opportunity is closed in Salesforce
  * Keeping Salesforce accounts and Business Central customers in sync


## Connection Types
Microsoft Dynamics 365 Business Central connections use the following authentication types:
  * Basic Auth
Uses access keys.
  * OAuth2
Uses a user’s Microsoft 365 or Azure AD credentials.


## See Also
  * Introduction to Anypoint Connectors
  * Use Exchange to Discover Connectors, Templates, and Examples
  * Microsoft Dynamics 365 Business Central Connector Reference
  * MuleSoft Help Center