Summary
Many Clockspring flows rely on recurring attribute patterns for routing, API calls, filenames, deduplication, error handling, and coordinating multi-step workflows. These patterns make flows predictable, maintainable, and environment-agnostic.
1. Correlation IDs
Use a correlation ID to track a FlowFile across processors, retries, and external systems.
Pattern:
Set once at the start of the flow:
Include it in logs, API headers, and downstream processors.
It becomes your primary debugging anchor.
2. Extracting keys from content for later use
When content will be overwritten (API calls, record transformations, merges), extract the fields you need to preserve.
Common extracted attributes:
customer.idorder.idevent.timestampnext.page.token
These attributes carry critical context even when the content changes entirely.
3. Constructing API endpoints dynamically
Attributes often determine which resource an API call targets.
Pattern:
#{base_url}= parameter (environment-specific)${customer.id}= attribute (FlowFile-specific)
This ensures the same flow works across Dev/Test/Prod while still acting on per-record values.
4. Building filenames and paths
Attributes help build meaningful, traceable file names and storage paths.
Examples:
Use attributes for uniqueness and traceability; use parameters for environment-specific paths.
5. Routing decisions
Most routing logic comes from attributes.
Examples:
${record.count:gt(0)}→ has data${mime.type:contains("json")}→ JSON path${color:equals("blue")}→ Blue path
Small, predictable attributes drive clean flow branching.
6. Deduplication keys
DetectDuplicate and cache-based logic require stable, deterministic keys.
Common patterns:
${sha256}${customer.id}:${event.timestamp}${record.id}
Good dedup keys survive retries and replays.
7. Pagination and resume tokens
APIs often return tokens or cursors for retrieving subsequent pages.
Extract and store:
next.page.tokennext.offsetnext.cursor
These attributes drive iterative InvokeHTTP calls or loops.
8. Retry counters
When implementing custom retry logic, increment a counter on each attempt.
Example:
Use routing to stop retrying if it exceeds a threshold.
9. Audit attributes
Add lightweight metadata to FlowFiles for traceability.
Common audit attributes:
source.systemflow.nameprocessed.timestamplast.updated.by
These values simplify troubleshooting and operational review.
10. Mixing parameters and attributes in the same property
In real flows, you often combine environment-level parameters with FlowFile-level attributes.
Pattern:
#{}= parameters (Dev/Test/Prod differences)${}= attributes (the specific values from the FlowFile)
More examples:
Why this works:
Flows stay environment-independent
Logic stays tied to the FlowFile
URLs, queries, and paths stay flexible and maintainable
Rule:
Parameters define the environment.
Attributes define the FlowFile.
Use both if you need dynamic behavior.
Related Articles
FlowFile Content vs Attributes
How Attributes Move Through a Flow
Expression Language Basics
Best Practices for Attributes
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article