Practical Tutorial: Scheduled Data Cleanup Strategy on Qeasy for Strategy-Level Data Lifecycle Management
What This Strategy Solves
After running on the Qeasy data integration platform for a while, every sync strategy leaves behind a large amount of historical records — logs, intermediate results, field-mapping snapshots, response payloads, and so on. At one retail customer's site we saw the run history of just the "Material Sync" strategy pile up to several GB after six months, and platform list queries became visibly slower.
The "Scheduled Data Cleanup" strategy is exactly for strategy-level data lifecycle management: it removes historical data of designated target strategies on a schedule. Both source and target are inside Qeasy, and it calls the platform's built-in DeleteStrategyData API. It is an O&M-style strategy and does not move any business data between business systems.
Data Flow and Field Mapping
The flow is INTERNAL → INTERNAL. Both source and target systems are the Qeasy integration platform itself.
| Role | System | API / Action | Key Fields | Notes |
|---|---|---|---|---|
| Source | Qeasy Integration Platform | DeleteStrategyData (QUERY/POST) | target_1, target_2 | Object holding target strategies to clean; target_1 is required, target_2 optional |
| Middleware | Qeasy Scheduler | Trigger by crontab | datetime, {{random}} | Timestamp and request id for idempotency and tracing |
| Target | Qeasy Integration Platform | Write-Empty (EXECUTE/POST) | id | Placeholder execution; no business data, only an audit record |
Note: target_1 is a required object field representing "which target strategies to clean". If multiple groups need to be cleaned in the same window, extend target_2, target_3, etc., following the same object structure.
How to Configure It on Qeasy
The source metadata uses Qeasy's built-in DeleteStrategyData API. Key configuration points:
- Choose the API: In the source strategy metadata, select
DeleteStrategyData, typeQUERY, methodPOST, primary keydatetime. - Target strategy objects: Fill
target_1with the strategy codes you want to clean; addtarget_2for additional groups. - id and idempotency: Use
{{random}}foridand turn onidCheckso every request is independent and retryable. - Target placeholder: The target strategy uses "Write-Empty", method
POST, primary keyid, with empty request/response arrays — this produces a clean execution record for audit tracing. - Build model: Set
buildModel=falseandautoFillResponse=falsebecause no business model derivation is needed.
Implementation Steps
This is an O&M strategy, so the schedule should follow the principle of "off-peak hours + offset from business schedules".
- Step 1: Choose the cleanup window. The source crontab in the source file is
13 2 * * *, i.e. 02:13 every day, which is right after most business syncs finish. - Step 2: Decide cleanup targets. Put the strategy codes to clean into
target_1. Don't write everything at once — start with the 1-2 strategies whose logs grow fastest. - Step 3: Manual full trigger before going live. Trigger manually before scheduling to confirm the target strategy's historical data is deleted correctly and no in-flight intermediate state is removed.
- Step 4: Switch to scheduled execution. Set the target-side crontab to a low-frequency placeholder (the source uses
1 1 1 1 1, which almost never fires). The source side runs daily at13 2 * * *. Adjust later based on database growth — e.g. switch to weekly0 3 * * 0. - Step 5: Monitoring and alerting. On Qeasy, observe database size and list-query latency before and after cleanup, and route cleanup failures into the alerting channel so silent failures don't go unnoticed.
Pitfalls We've Hit
- Cleanup window collides with business sync. At one manufacturing customer's site, cleanup was scheduled at 8 PM and collided with the "Sales Order Sync" — some in-flight order state was removed, causing reconciliation errors the next day. The safe approach is to schedule it between 2-4 AM and use a
datetimecutoff field on the source side so only records older than the cutoff are deleted. target_1accidentally points to an active strategy. A typical mistake: putting the code of a high-frequency strategy intotarget_1, which removes its critical run records and breaks troubleshooting. Maintain a separate "do-not-clean whitelist".- Treating "Data Cleanup" as a business sync strategy. Its source and target are both inside Qeasy; in the overall plan its sequence is usually A, but it doesn't move business data. Placing it as a downstream dependency of sequence B will create a tangled dependency graph.
idCheckleft off causes duplicate cleanup requests. Using{{random}}foridwithout enablingidCheckcan lead to multiple delete requests for the same batch on retry. The API is idempotent itself, but the logs become noisy.- Over-cleaning vs under-cleaning. Cleaning too many strategies at once causes brief lock contention; cleaning too few makes the strategy pointless. A common pattern we use on Qeasy is incremental + full dual-track: lightweight incremental cleanup on a daily crontab, plus a monthly full reconciliation cleanup.
When to Use It and When Not To
Use it: Private deployments running on Qeasy for more than 3 months, with many strategies (≥10) and fast-growing per-strategy run storage; or scenarios that need to enforce a compliance retention period by regularly clearing expired data. Don't use it: Projects still in pilot with very few strategies; or scenarios that require long-term audit archiving of every run record (in those cases archive instead of clean up).