Metadata Propagation Between Flows

Anypoint Studio 7.10 infers the metadata of your flow so that, when you use a Flow Reference component to reference another flow, you can set the metadata from your flow as custom metadata for your referenced flow.

Using the Flow Reference component in Anypoint Studio enables you to automatically rather than manually propagate metadata in your flow to the flow referenced by it.

When you use Studio to scaffold your flows based on a RAML specification, Studio infers the metadata of your flow based on your RAML specification’s types. However, because Union types are not supported, Studio does not infer your Union type values as metadata.

For example, consider a flow named flow-1 that uses a Set Payload component to create a JSON payload:

Actual Metadata Sample
{
  "value": {
    "ID": 1,
    "departureDate": "2016/12/20",
    "emptySeats": 200,
    "plane": {
      "type": "Boeing 747",
      "totalSeats": 400
    }
  }
}

When you add a Flow Reference component to a second flow, flow-2, Studio detects the metadata in flow-1 as the actual metadata that the referenced flow receives and automatically assigns it as custom metadata in flow-2 if the flow does not already have custom metadata declared for it.

Because the metadata in flow-2 is set once, it can’t update automatically if you modify the metadata in flow-1. For this example, if you choose to modify the actual metadata sample for the Set Payload component in flow-1, you must update the custom metadata in flow-2.

Consider now that flow-2 has custom metadata configured already using the following JSON example:

Expected Metadata Sample
{
  "value": {
    "ID": 1,
    "code": "GQ574",
    "price": 399,
    "departureDate": "2016/12/20",
    "origin": "ORD",
    "destination": "SFO",
    "emptySeats": 200,
    "plane": {
      "type": "Boeing 747",
      "totalSeats": 400
    }
  }
}

Studio considers the custom metadata of flow-2 as the expected metadata for the referenced flow, and the metadata set by the Set Payload component in flow-1 as its actual metadata. You can choose to either overwrite the expected metadata with the actual metadata, or customize it so that you choose what metadata you want to overwrite, and which metadata you want to preserve.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub