Using Perceptive Flow Design
Mule Runtime Engine versions 3.5, 3.6, and 3.7 reached End of Life on or before January 25, 2020. For more information, contact your Customer Success Manager to determine how you can migrate to the latest Mule version. |
Building upon the certainty that connection testing establishes, Mule takes one more step to make designing your application easier with Perceptive Flow Design. If you model a flow to include an Anypoint Connector, preceded or followed by an Anypoint DataMapper Transformer, Mule uses the working connection to the resource to retrieve metadata about message payload and properties. Capturing the data type and structure that a resource employs, Mule feeds that data into the DataMapper Transformer, thereby informing the DataMapper of the expected input or output. This functionality facilitates mapping of data from one data format and structure to another.
Prerequisites
This document assumes that you are familiar with the Visual Editor in Anypoint Studio and the Anypoint Connectors and DataMapper Transformer that you can use to create applications in Studio. Further, this document references Connectors and Global Elements. Review DataSense to learn more about the overall DataSense functionality.
Designing with Metadata
It is very common to use Mule to connect with a SaaS provider in an application. However, because each SaaS provider supports different data types and structures, it is challenging to map data to or from them. Connecting with Salesforce, for example, involves more than just a simple plug and play connection– you must examine the data structure of Salesforce to determine the expected data input or output. If Salesforce employed the same data structure as the raw messages in your application, you could simply map "username" to "username", but there are likely complexities that make direct mapping impossible. For example, you may need to disassemble the "username" input to map it to "company_name" output.
To make mapping data easier, DataSense’s perceptive functionality performs the following activities:
-
Tests connections to the SaaS providers to which you wish to connect
-
Retrieves metadata from the SaaS providers to acquire information about the data structure and format each employs
-
Supplies the sObject type for the data input or output for use by DataMapper
In other words, Mule intelligently examines the structure of the input or output data you intend to map, then feeds the correct input or output values into your DataMapper. Using Perceptive Flow Design, you don’t need to figure out the data structures manually. Mule’s automated connection testing and metadata retrieval gives you a higher level of certainty that your flow will run without errors.
Limitations
-
Perceptive Flow Design is only available in Studio’s Visual Editor.
-
To use Perceptive Flow Design, you must configure at least one Anypoint connector, test its connections, then insert a DataMapper into your flow before or after the connector.
-
Perceptive Flow Design only functions with Anypoint connectors which support connection testing. See the list.
Building a Perceptive Flow
-
Begin by building a flow which contains at least one connector which supports connection testing. For example, create a flow with a Salesforce Connector.
-
Configure the Salesforce connector, and its corresponding global connector, then test the connection to confirm communication. Refer to Testing Connections for details.
-
Once you have confirmed successful connection to Salesforce, insert a DataMapper before the connector on your canvas.
-
Open the DataMapper Properties Editor. Enter the descriptive details on the first page, then click Next.
-
Having already retrieved details about data structure and format from Salesforce (because you have successfully connected via your global connector), Mule automatically prescribes the Output.
-
Manually define the input values for DataMapper, then click Create New Mapping.
-
Studio opens the DataMapper console and displays the input fields you manually defined at left, and the output fields that DataSense retrieved from Salesforce at right.
-
Drag and drop input fields across to output fields to map and transform data format to Salesforce-friendly values. See example below.
-
Save, then continue to build your Mule application.
Clearing DataSense Metadata
In some cases, you may need to clear the metadata gathered by DataSense – for example if the name of an attribute on the remote application has changed. You can clear the metadata for any DataSense-enabled connector that you have placed on the Studio canvas.
There are two ways to clear metadata:
-
In the Connection Explorer pane, right-click the connector name, then select Clear DataSense Metadata.
-
In the Studio canvas, right-click the connector, then select Clear DataSense Metadata.
The Clear DataSense Metadata option does not appear, or appears grayed-out, unless DataSense has already gathered metadata for the selected connector.
Clicking Clear DataSense Metadata causes Studio to automatically clear the metadata. This operation preserves the connector’s configuration, including any parameters such as operations, queries, etc. When you reconfigure your connector, DataSense again gathers metadata from the remote application.
See Also
-
Learn more about Anypoint DataMapper through the Datamapper User Guide and Reference. Specifically on the subject of metadata, see Defining DataMapper Input and Output Metadata.
-
Deploy your application to Runtime Manager.