Qeasy Cloud
Get Started

Field Manual for the Strategy Execution Error Detail API: Closing the Loop from Execution Records to the Weighing System

· 冯潇· Engineering Best Practices· 39 views· 4 min read

What This API Solves

In the "payment application → U8 payment voucher" synchronization chain, business systems care about one thing: did this payment voucher actually sync successfully? The StrategyErrorDetail API was built for exactly this question. It aggregates every strategy execution outcome—success, error, root cause, and resolution—so downstream weighing systems can write back the status and close the loop.

API Capability Overview

  • Authentication: An internal platform API. Callers use credentials issued by the integration platform; in Qeasy (QingYiYun), it is typically invoked through built-in connectors in the scheduler or aggregation component, with no manual auth handling.
  • Request Structure: Supports combined filtering by time window (recentSeconds), strategy ID list (ids), and status (status: 3 = error, 6 = skipped, 2 = completed).
  • Response Structure: Returns an array of execution records; each record contains strategy info, business document number, timestamp, response summary, problem description, cause analysis, and resolution.
  • Pagination / Incremental Mode: The typical pattern is incremental polling with a "last N seconds" window, where N is usually 60–300 seconds. This balances timeliness and avoids missed records.
  • Status Convention: status = 2 means successfully completed, 3 means error, 6 means skipped by the scheduler.

Typical Field Mappings

FieldTypeMeaningPractical Notes
strategy_idstringUnique strategy identifierCorresponds to the ids query parameter; the primary key for cross-strategy tracking
strategy_namestringStrategy nameReadable label, useful for logs and troubleshooting
numberstringBusiness document number (payment application number)Core key for writing back to the weighing system; must be unique on the weighing side
response_atstringResponse timestampUsed for incremental window calculation; normalize to UTC or local time
textstringResponse summaryEmpty or "response data is empty" → success (S); otherwise → error (E)
problemstringProblem descriptionWritten back directly as ErrorMsg; watch the length limit
cause_analysisstringRoot cause analysisUsed for human troubleshooting and knowledge base accumulation
solutionstringSuggested resolutionCan integrate with ticket systems to reduce repetitive questions
lesseeobjectTenant informationRequired in multi-tenant scenarios to avoid writing to the wrong book

In Qeasy, this API is typically used in an "aggregation query + time window filter" pattern: Qeasy's field mapper automatically derives S/E status from text, passes problem through to ErrorMsg, and writes back to the target table USP_edu_PaidAmountBill_Status_Save.

How to Configure on Qeasy

  1. Data Source Connector: Register StrategyErrorDetail as a query-type connector in the Qeasy Data Integration Platform, with credentials and a default time window configured.
  2. Strategy Orchestration: Create a new strategy "4-Query Execution Results, Write Back to Weighing System"; the upstream has no source-system dependency and consumes the platform API directly.
  3. Field Mapper: In the mapping canvas, drag and connect source field number → PaidAmountBillNo, text → Status (with a decision function), problem → ErrorMsg.
  4. Execution Schedule: Schedule every 1–3 minutes; set recentSeconds slightly larger than the interval to avoid boundary misses.
  5. Exception Handling: Enable built-in retry and alerting; also alert on N consecutive empty responses to prevent silent failures.

Cross-Scenario Practical Points

  1. Leave Headroom in the Time Window: recentSeconds should not equal the schedule cycle exactly; leaving 20%–50% headroom significantly reduces boundary misses.
  2. Status Logic Should Be a Function, Not Hardcoded: Encode the text → S/E mapping as configurable rules so new business lines only require rule changes, not code changes.
  3. number Is the Lifeline of Writeback: Deduplicate and validate non-empty values before cross-system transfer; PaidAmountBillNo on the weighing side usually has a unique constraint.
  4. Never Drop lessee: In multi-tenant or multi-subsidiary scenarios, tenant info is the only way to route to the correct ledger.
  5. Empty text ≠ Full Success: Combine with status; in some scenarios status=2 but text is non-empty and still needs to be logged.
  6. Truncate Error Messages: The weighing system's remark field is length-limited; long problem values get truncated or fail to write. Substring truncation in the Qeasy mapper is the engineering standard.

Pitfall Retrospective

  • Pitfall 1: Schedule Cycle and Time Window Mismatch. A common pattern is 60-second scheduling with a 60-second window, which misses half of the boundary records. The reliable approach is 60-second scheduling with a 120-second window, and recording the first-seen timestamp.
  • Pitfall 2: Treating Empty text as Success. Some strategies leave text empty even when data validation fails, even though nothing was actually written to the target. Always combine with status, or add a fallback on whether response_at exists in the mapper.
  • Pitfall 3: Cross-Tenant Data Bleed. When multiple subsidiaries share one integration, writebacks without lessee end up routing Company A's payment status into Company B's ledger. Always include the tenant field in the mapping and use it for routing.
  • Pitfall 4: Oversized Error Messages Cause Write Failures. The weighing remark field is typically varchar(500); problem often exceeds a thousand characters. Truncating with substring in the Qeasy mapper is standard practice.
  • Pitfall 5: No Idempotency Considered. When the same payment application is written back multiple times, the weighing system either errors out or gets overwritten. Use number + response_at as a unique key for deduplication before writing.

When to Use

When business needs to "feed integration platform execution results back to the business system," this API is the go-to choice: typical use cases include payment vouchers, purchase inbound orders, and receipt writeback loops. If you only need internal logging or alerting inside Qeasy, this API is unnecessary. If you need to aggregate results across multiple strategies across platforms, this API also supports batch queries via the ids parameter and scales well.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/engineering/hb-p2-046-493b

Comments