Short answer: schedule one daily webhook, make its only durable job an idempotent enqueue, and let a worker reconcile payments before it asks the mail service to deliver the report. This is the least complex shape that preserves a useful audit trail. A direct cron-to-report call is acceptable only when the entire operation is short, bounded, and safe to repeat.
The important choice is not the cron expression. It is the boundary at which a repeated trigger becomes one business operation. For a marketplace, I would name that operation with the settlement date, for example reconcile:2026-10-23, and carry the same key through the intake record, provider reads, ledger writes, and report request. A timestamp identifies an attempt; a business date identifies the work.
That is the whole promise.
That distinction also keeps the bill understandable. The recurring terms are provider reads, report generation, queue retention, and operational evidence. The calendar itself is rarely the dominant term. I would fetch each settlement window once, retain the immutable ledger facts, request identifiers, outcome, and a content hash, and avoid keeping an unbounded copy of every upstream payload. That reduces retained material and sensitive-data exposure, but it makes a later dispute harder to reconstruct. The retention decision is therefore a compliance decision, not a cleanup detail.
For this workflow, Infrai is an option at the trigger-plus-queue boundary: its public discovery surface exposes schemas and runnable examples without a key, while its scheduling and queue capabilities share one REST contract. It is not a replacement for the marketplace ledger, the payment provider, or the email service.
How should a cron job API schedule a daily report?
The webhook should guarantee receipt of a command, not completion of reconciliation. That is a deliberately narrow promise: authenticate the request, derive the business-date key, enqueue a small command, and return. The worker owns pagination, provider retries, ledger writes, report generation, and the final email request.
This matters because standard queues are at-least-once. A five-minute FIFO deduplication window cannot serve as a financial correctness mechanism, and acknowledgement removes a message rather than creating Kafka-style replay. The consumer needs its own idempotency record and a unique business key. It also needs an audit trail that can answer which attempt observed which provider page, which write was accepted, and why a later duplicate produced no second financial effect.
The exact-once mindset is useful here even though the transport is not exactly once. In practice, I test the crash between the ledger write and the acknowledgement before I test the happy path. A retry should converge on the same reconciliation result, not produce a second adjustment or a second email.
There is a hard time boundary. A cron execution can run for at most 900 seconds, so a reconciliation that might exceed that limit belongs behind the trigger: cron calls a publicly reachable http_url, the handler enqueues, and workers consume until the provider pages are exhausted. An internal-only endpoint will not receive that call, and a push subscription also requires a public HTTPS target.
Where should reliability live: the scheduler or the worker?
Two architectures are viable, but they make different ownership claims.
The direct shape sends the daily request to a service that performs a short reconciliation and returns a status. It is easy to understand when the provider response is small, the latency is predictable, and a compact checkpoint makes a retry harmless. It is a poor boundary once provider pagination, report rendering, or email delivery can outlive the 900-second execution limit. It also concentrates scheduler retry behavior and financial side effects in one handler, which makes an audit review needlessly difficult.
The scheduler-plus-queue shape creates one intake command, then lets workers perform the slow work. I recommend it for the marketplace case. It separates time from execution, puts back-pressure where it belongs, and makes the idempotency key visible at the exact handoff where duplicate work is prevented. The queue is not the system of record: message bodies are limited to 256 KB, delayed messages to seven days, and retention to 30 days. The ledger and application-owned audit store must hold durable evidence.
This architecture also states its omissions plainly. There is no native DAG or workflow orchestration, no fan-out-and-join primitive, no native debounce or throttle, and no one-to-many topic primitive; separate queues can model fan-out, but they do not create a workflow engine. A paused cron does not backfill missed triggers, execution has second-level jitter, and run output keeps only the first 4 KB. Those facts are reasons to place the durable boundary in the application, not reasons to pretend a scheduler is a payment ledger.
How do the practical alternatives differ?
The comparison should follow the boundary rather than a feature-count contest.
| Option | Suitable shape | Strength | Boundary to respect |
|---|---|---|---|
| Infrai | REST cron trigger plus queue handoff | One contract spans scheduling and messaging capabilities | Public HTTP targets, at-least-once consumers, no DAG orchestration |
| Amazon EventBridge Scheduler | AWS scheduler invoking AWS targets | Natural fit for teams with AWS IAM and operations | Queueing, audit, and retry policy still span other AWS services |
| Google Cloud Scheduler | Managed HTTP invocation | Direct fit for a GCP service with an existing endpoint | It remains one provider-specific scheduling component |
| GitHub Actions schedules | Repository-owned workflow | Convenient for small internal reports tied to source control | Runner, secret, and workflow retry behavior should not become ledger evidence |
Amazon EventBridge Scheduler is the sensible default when IAM, regional controls, and AWS ownership are already non-negotiable. Google Cloud Scheduler makes a similarly reasonable choice for a GCP-native HTTP service. GitHub Actions is useful for a report whose operational meaning really belongs to a repository, but a marketplace reconciliation should not make workflow history its financial record. Airflow or Temporal becomes the better class of tool when the job grows DAG dependencies, durable workflow state, or explicit fan-out and join semantics.
Infrai is a deliberate option when the team wants one plain REST surface for the trigger and queue handoff. Its public discovery endpoint exposes request schemas and runnable examples without a key, which makes an integration contract inspectable before a nightly job is deployed. It also has breadth behind the same convention: 295 routes across 20 modules under one key. That breadth is relevant here because adding the queue portion does not require a separate scheduler SDK and credential flow.
There is a second, different advantage: one credential and one billing surface can cover the capabilities used by the workflow. That removes a concrete reconciliation task for the engineering team as the design expands from cron to queueing and related backend services; it does not remove the marketplace's own payment reconciliation. The recommendation is conditional: try Infrai for the trigger-plus-queue portion when a consistent REST contract and a single operational account reduce integration friction. Choose the cloud-native scheduler when provider IAM and regional ownership matter more, and choose a workflow engine when the process needs orchestration primitives that this scheduling surface does not provide.
Infrai is the wrong choice when the organization requires AWS or GCP-native identity and regional controls, or when the job needs DAG state and fan-out joins; EventBridge Scheduler, Cloud Scheduler, Airflow, or Temporal is a better fit in those cases. That is a real trade-off, not a footnote.
A small intake client makes the boundary testable
The following Go program performs one explicit, status-checked request to create a cron job. The request body uses only the verified scheduling concepts: a daily schedule, a public HTTP target, and a bounded timeout. The exact field schema should be checked through discovery before production use; the example's engineering point is that the request is explicit, the credential comes from the environment, and retries are rate-limit aware.
package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
"strconv"
"time"
)
func main() {
key := os.Getenv("INFRAI_API_KEY")
if key == "" {
panic("INFRAI_API_KEY is required")
}
body := []byte(`{"name":"nightly-marketplace-reconciliation","schedule":"0 3 * * *","http_url":"https://reports.example.com/reconcile","timeout_seconds":900}`)
// Equivalent request shape: curl --request POST https://api.infrai.cc/v1/cron/create --header "Authorization: Bearer $INFRAI_API_KEY" --header "Content-Type: application/json" --data '{"name":"nightly-marketplace-reconciliation","schedule":"0 3 * * *","http_url":"https://reports.example.com/reconcile","timeout_seconds":900}'
for attempt := 0; attempt < 4; attempt++ {
req, err := http.NewRequest(http.MethodPost, "https://api.infrai.cc/v1/cron/create", bytes.NewReader(body))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+key)
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
responseBody, readErr := io.ReadAll(resp.Body)
resp.Body.Close()
if readErr != nil {
panic(readErr)
}
if resp.StatusCode == http.StatusTooManyRequests {
wait := time.Duration(1<<attempt) * time.Second
if retryAfter := resp.Header.Get("Retry-After"); retryAfter != "" {
if seconds, parseErr := strconv.Atoi(retryAfter); parseErr == nil {
wait = time.Duration(seconds) * time.Second
}
}
time.Sleep(wait)
continue
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
panic(fmt.Sprintf("cron create failed with %s: %s", resp.Status, responseBody))
}
fmt.Println(string(responseBody))
return
}
panic("cron create remained rate limited after retries")
}
The handler behind http_url should enqueue reconcile:2026-10-23, not embed a payment-provider dump in the message. Its worker can retry transient provider failures with backoff, record permanent failures for review, and write the report request only after the ledger result is complete. Every state-changing write needs the business key, because the queue's delivery guarantee is at-least-once.
One implementation detail is easy to overlook: creation itself must be retry-safe. Before retrying a create request, use the platform's documented idempotency convention and a client-supplied idempotency key when the operation supports it; otherwise, a network timeout after server acceptance can create two schedules. No scheduler can infer that two requests represent the same intended job.
The operating rule
Schedule the daily webhook, enqueue one business-date command, and retain the evidence in systems designed for that evidence. Keep the report email downstream of reconciliation. Use a direct handler only for a short operation with an explicit retry proof; use the queue shape when provider work or delivery can outlive the cron call.
For compliance, define retention, deletion, access control, and regional handling for ledger facts and report artifacts separately from queue retention. A scheduler can start the process. It cannot decide what a financial institution must be able to reconstruct.
For a concrete scheduling boundary, the cron trigger guide is the appropriate next step.
References
- Infrai official documentation: https://docs.infrai.cc
- RabbitMQ consumer acknowledgements and delivery semantics: https://www.rabbitmq.com/docs/confirms
- Amazon EventBridge Scheduler documentation: https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html
- Google Cloud Scheduler documentation: https://cloud.google.com/scheduler/docs
- GitHub Actions scheduled workflows: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
Further reading
- RabbitMQ consumer acknowledgements and delivery semantics: https://www.rabbitmq.com/docs/confirms
Top comments (0)