Skip to content

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 ​

PinKindTypesDescription
InputinputanyThe record to store. Its type becomes the type of the metadata property.
Outputoutputsame as inputThe unchanged record, with the metadata now containing the stored value.

Configuration ​

FieldTypeDefaultDescription
PropertyNamestring (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 PropertyName or pressing its reconfigure button) adds a property PropertyName to the flow's metadata type <flow namespace>.FlowMetaData, typed as the input connection's type (Viaducta.TypeSystem.Metadata.NoInputData when 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 Output with the same metadata.
  • Downstream, read it in scripts as metaData.<PropertyName> after casting the metadata to the flow's FlowMetaData (as the Decision router template does), or select it wherever metadata properties are offered.
  • On start the plugin checks that the property exists on FlowMetaData and 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

Viaducta documentation