bulk-reporting-export
Skill0 starsChanged 12 days agoMITView on GitHub
Build memory-safe reporting and export endpoints: streaming XLSX (POI SXSSF), PDF, database-side aggregation, async jobs with 202, and spool cleanup.
In this repository68 other files it gives its agents.
- skills/web-development/adapters/copilot-instructions.mdCopilot instructions
- accessibility-auditSkill
- agent-handoffSkill
- ai-tool-securitySkill
- api-designSkill
- audit-loggingSkill
- background-jobsSkill
- changelog-generatorSkill
- ci-cdSkill
- codebase-onboardingSkill
- code-reviewSkill
- code-simplificationSkill
- context-engineeringSkill
- context-privacySkill
- data-import-exportSkill
- debuggingSkill
- dependency-auditSkill
- deprecation-and-migrationSkill
- design-tokensSkill
- documentation-and-adrsSkill
- doubt-driven-developmentSkill
- environmental-telemetrySkill
- erp-accountingSkill
- erp-domain-designSkill
- erp-inventorySkill
- erp-procurementSkill
- erp-salesSkill
- feature-flagsSkill
- forms-and-validationSkill
- frontend-stateSkill
- frontend-ui-engineeringSkill
- git-workflowSkill
- identity-access-managementSkill
- incremental-implementationSkill
- java-code-standardsSkill
- java-deliverySkill
- kerangkaSkill
- mcp-builderSkill
- membership-managementSkill
- observabilitySkill
- performance-optimizationSkill
- planning-and-task-breakdownSkill
- product-analyticsSkill
- quarkus-observabilitySkill
- quarkus-persistenceSkill
- quarkus-securitySkill
- quarkus-serviceSkill
- quarkus-testingSkill
- responsive-layoutSkill
- rest-api-contractSkill
- saas-billingSkill
- saas-multitenancySkill
- saas-onboardingSkill
- security-hardeningSkill
- shipping-and-launchSkill
- skill-creatorSkill
- skill-evaluationSkill
- source-driven-developmentSkill
- spec-driven-developmentSkill
- test-driven-developmentSkill
- The first 60 shown.
The file
Files
Bulk Reporting & Export
Overview
Reporting is usually where memory and latency problems appear first, because it is the place that touches whole datasets rather than one page.
When to use
- Building any endpoint in the
reportingmodule - An export is slow or throws
OutOfMemoryError - A report will exceed a few thousand rows
- Adding progress reporting to a long-running job
Hand off when
| Need | Skill |
| Ordinary paginated list | rest-api-contract |
| Query and index tuning | quarkus-persistence |
| Who may download what | quarkus-security |
| Export duration metrics | quarkus-observability |
Process
- Never hold a full result set in memory — not in a
List, not in a DTO collection, not in an in-memory workbook. The demo works because 300 rows fit anywhere; the same code meets 100,000 rows of real data in production and throwsOutOfMemoryError. - Stream out of the database and into the file. A scrolled/streamed query with a JDBC
fetch size, feeding
SXSSFWorkbookwith a bounded row window. Callwb.dispose(), or the temporary files it wrote stay on the spool volume. - Aggregate in the database, not in Java. Sums, counts and group-bys belong in SQL.
- Decide synchronous or asynchronous by size, then keep to the targets below.
- Put job state somewhere that survives a restart, and make a duplicate submit idempotent — users click twice.
- Authorise at download time on owner or unit, not on role alone. The file already exists by then; the request that fetches it is the last check there is.
- Give the spool a retention job. Storage with no expiry grows until it stops the service.
| Report size | Shape and target |
| < 1,000 rows | Synchronous, < 2 s |
| 1,000-10,000 rows | Synchronous, < 10 s |
| 10,000-100,000 rows | Async, < 60 s |
| > 100,000 rows | Async, chunked, with progress |
Heap stays under 1 GB regardless of report size. If it does not, something is still being buffered.
Verification
- Heap stays bounded as row count grows (stream, do not buffer)
- Jobs survive restart (state not only in memory)
- Downloads check owner/unit, not just role
- Duplicate submit is idempotent
Red flags
| Pitfall | Symptom |
XSSFWorkbook instead of SXSSF | OutOfMemoryError at ~50k rows |
Missing wb.dispose() | Spool disk fills up over weeks |
| No JDBC fetch size | The driver buffers the whole result anyway |
| Job state in memory | Jobs lost on deploy; broken behind a load balancer |
| Synchronous long export | Thread pool exhausted; unrelated endpoints time out |
| Aggregating in Java | Slow report, high memory, needless database load |
| No retention job | Storage grows without limit |
| No idempotency | Duplicate jobs when users click twice |
| Download without an ownership check | Cross-unit data exposure |
References
references/streaming-and-formats.md- streaming a query into XLSX, PDF and ZIP; database-side aggregationreferences/async-jobs.md- when to go async, the job record, SSE progress, idempotencyreferences/spool-and-access.md- spool storage and cleanup, download authorisation, performance targets
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

