Appearance
Pin to metadata
Stores the record passing through in a named property of the flow metadata and forwards it unchanged. Later components and scripts of the same request can read the value from the metadata without a direct connection, for example to combine the original request with a later response.
Pins
| Pin | Kind | Types | Description |
|---|---|---|---|
| Input | input | any | The record to store. Its type becomes the type of the metadata property. |
| Output | output | same as input | The unchanged record, with the metadata now containing the stored value. |
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
PropertyName | string (identifier) | Required. Name of the metadata property, a valid C# identifier unique within the flow metadata. Changing it regenerates the metadata property. |
Behaviour
- Reconfigure (changing
PropertyNameor pressing its reconfigure button) adds a propertyPropertyNameto the flow's metadata type<flow namespace>.FlowMetaData, typed as the input connection's type (Viaducta.TypeSystem.Metadata.NoInputDatawhen the input is not connected). The property belongs to this component; renaming replaces it. - For each record the value is stored in the metadata (wrapped values are unwrapped first), then the record is sent to
Outputwith the same metadata. - Downstream, read it in scripts as
metaData.<PropertyName>after casting the metadata to the flow'sFlowMetaData(as the Decision router template does), or select it wherever metadata properties are offered. - On start the plugin checks that the property exists on
FlowMetaDataand that its type matches the input connection's type; otherwise the flow fails to start ("The input type does not match metadata ..., reconfigure the pin component").
Notes
- After changing the type of the input connection, reconfigure the component so the metadata property gets the new type.
- The value is stored per request (in that request's metadata). Components that create new metadata (for example a Plugin port request, or Timer-started branches) do not see it.
- The stored object is the same instance as the forwarded record; changes made downstream to the record are visible through the metadata property as well.
Example
json
{ "PropertyName": "OriginalRequest" }Http listener → Pin to metadata → Http client → Script (uses metaData.OriginalRequest) → Http response