Financial platforms and enterprise systems frequently provide transaction export capabilities to support reporting, reconciliation, auditing, and regulatory compliance workflows. In many environments, these exports involve very large datasets containing hundreds of thousands or even millions of transaction records. Traditional REST API implementations often construct the entire export payload in application memory before transmitting the response to the client, which can lead to high memory consumption and delayed response initiation when processing large datasets. This paper presents a streaming-based REST API architecture that retrieves transaction records incrementally from relational databases and writes them directly to the HTTP response output stream. By integrating database cursor retrieval with progressive HTTP transmission, the proposed design allows export data to be delivered continuously as records are processed rather than after the full dataset has been assembled. The architecture is implemented using a Java-based JAX-RS framework with the StreamingOutput interface and supports multiple financial export formats including CSV, OFX, QFX, and QBO. In practice, the streaming approach significantly reduces memory buffering requirements and allows large export downloads to begin immediately, improving responsiveness and scalability for high-volume export operations.
翻译:金融平台和企业系统通常提供交易导出功能以支持报表生成、对账、审计及监管合规工作流。在许多应用场景中,这些导出操作涉及包含数十万乃至数百万条交易记录的极大规模数据集。传统的REST API实现通常在应用内存中构建完整的导出负载后再向客户端传输响应,这在处理大规模数据集时可能导致高内存消耗和响应启动延迟。本文提出一种基于流式传输的REST API架构,该架构从关系型数据库增量检索交易记录,并将其直接写入HTTP响应输出流。通过将数据库游标检索与渐进式HTTP传输相结合,所提出的设计使得导出数据能够在记录处理过程中持续传输,而无需等待完整数据集组装完成。该架构采用基于Java的JAX-RS框架配合StreamingOutput接口实现,支持包括CSV、OFX、QFX和QBO在内的多种金融导出格式。实践表明,该流式处理方法显著降低了内存缓冲需求,使得大规模导出下载能够即时启动,从而提升了高吞吐量导出操作的响应性与可扩展性。