A fintech access review needs an owner who can sign it. Start with one webhook receiver, publish each accepted platform event to a queue, and give the internal consumers independent subscriptions. That is the least complex arrangement that keeps adding a reviewer-facing projection from becoming another external webhook registration.
TL;DR: receive once and route internally. Put a spend admission decision before downstream work, record refused traffic, and distinguish acceptance into the queue from completion by every consumer. A ceiling that silently drops evidence leaves the reviewer with a misleadingly complete report.
The practical decision is how much unfinished review work the application can tolerate when its spending allowance runs out. A queue can let a slow consumer catch up. It cannot turn refused traffic into completed evidence.
How should one platform event reach several internal consumers before sign-off?
For this walkthrough, the proposed review has three internal consumers: an evidence journal, an entitlement projection, and a review packet builder. These are application roles, not claims about a provider's supplied integrations. The packet should identify which accepted events each role has processed, which remain pending, and which were refused at admission. A useful sign-off statement has a boundary: this packet covers a named set of accepted events, with outstanding work listed separately.
Keep that boundary visible.
The data flow is straightforward. The receiver verifies the incoming webhook using the sender's documented procedure, obtains a stable event identity, and records its admission decision. An accepted event enters a durable queue, whose subscription arrangement supplies a separate copy to each intended consumer. Consumers deduplicate their effects using the event identity and their own consumer name. Their completion records then feed the review packet. The receiver acknowledges acceptance only after durable handoff; its exact response and retry contract must match the sender's documentation.
A shared work queue with competing workers is a trap here: dividing events among three workers does not establish that all three application roles saw every event. Choose a subscription topology that gives each role its own delivery state. Keep the external registration narrow, and change routing inside the application.
Make admission and duplicate handling executable
The following TypeScript program retrieves the public discovery document and models the application policy locally. Save it as review.ts and run it with a TypeScript runner such as tsx in a runtime with built-in fetch. Set INFRAI_API_BASE_URL to the platform API base ending in /v1, and load INFRAI_API_KEY through your secret manager. Discovery itself is public; the sample includes the Bearer authentication pattern used for subsequent authenticated operations. It uses an illustrative allowance of 6 work units, with 3 units reserved per admitted event because the example requires three consumer effects. These units are a policy input, not a currency amount or an estimate of any vendor's charges.
The example deliberately delivers one admitted event twice. It also submits a third unique event after the allowance is committed, so the output includes a refusal that a review packet must account for.
async function discover(): Promise<void> {
const base = process.env.INFRAI_API_BASE_URL;
const key = process.env.INFRAI_API_KEY;
if (!base || !key) throw new Error("Set the API base and secret key");
for (let attempt = 0; attempt < 4; attempt++) {
const response = await fetch(`${base.replace(/\/$/, "")}/discovery`, {
method: "GET",
headers: { Authorization: `Bearer ${key}` },
});
if (response.status === 429 && attempt < 3) {
const retry = response.headers.get("Retry-After");
const seconds = retry === null ? NaN : Number(retry);
const date = retry === null ? NaN : Date.parse(retry);
const wait = Number.isFinite(seconds)
? Math.max(0, seconds * 1000)
: Number.isFinite(date)
? Math.max(0, date - Date.now())
: 500 * 2 ** attempt;
await response.body?.cancel();
await new Promise((resolve) => setTimeout(resolve, wait));
continue;
}
if (!response.ok) {
throw new Error(`Discovery ${response.status}: ${await response.text()}`);
}
console.log(JSON.stringify(await response.json(), null, 2));
return;
}
}
type ReviewEvent = {
id: string;
subject: string;
decision: "retain" | "remove";
};
const consumers = ["journal", "entitlements", "packet"] as const;
type Consumer = (typeof consumers)[number];
type Admission = "accepted" | "refused";
const allowance = 6;
let reserved = 0;
const admissions = new Map<string, Admission>();
const subscriptions = new Map<Consumer, ReviewEvent[]>(
consumers.map((consumer) => [consumer, []]),
);
const effects = new Map<string, ReviewEvent>();
function admit(event: ReviewEvent): Admission {
const previous = admissions.get(event.id);
if (previous !== undefined) return previous;
if (reserved + consumers.length > allowance) {
admissions.set(event.id, "refused");
return "refused";
}
reserved += consumers.length;
admissions.set(event.id, "accepted");
for (const consumer of consumers) {
subscriptions.get(consumer)!.push(event);
}
return "accepted";
}
function apply(consumer: Consumer, event: ReviewEvent): void {
const key = JSON.stringify([consumer, event.id]);
if (effects.has(key)) return;
effects.set(key, event);
}
const events: ReviewEvent[] = [
{ id: "review-001", subject: "ledger-reader", decision: "retain" },
{ id: "review-002", subject: "export-operator", decision: "remove" },
{ id: "review-003", subject: "settlement-reader", decision: "retain" },
];
for (const event of events) admit(event);
admit(events[0]!);
subscriptions.get("journal")!.push(events[0]!);
for (const consumer of consumers) {
for (const event of subscriptions.get(consumer)!) {
apply(consumer, event);
}
}
const packet = events.map((event) => ({
eventId: event.id,
admission: admissions.get(event.id),
completedBy: consumers.filter((consumer) =>
effects.has(JSON.stringify([consumer, event.id])),
),
}));
console.log(JSON.stringify({ allowance, reserved, packet }, null, 2));
discover().catch((error: unknown) => {
console.error(error);
process.exitCode = 1;
});
The result reserves 6 units. Two events have effects recorded for all three consumers; the third has a refused admission and no completed consumers. Repeating the first event neither reserves another allowance nor creates a second journal effect.
The discovery request is read-only. Use its schemas and runnable examples to implement registration and queue publishing; take paths from the discovery path field. Don't guess request bodies. The local portion is an executable policy model, not a durable webhook service. Its maps disappear when the process exits, and its synchronous writes avoid the concurrency that a deployed receiver must handle. Persist admission identity, reservation, and a publish intent atomically, then deliver that intent through an outbox worker. Otherwise a crash between reserving allowance and publishing the event can leave accepted work absent from the queue. At the consumer, make the deduplication record and the business effect one atomic operation, or use an idempotent downstream operation whose result can be reconciled.
That boundary deserves more implementation attention than the HTTP handler. Standard queues must be treated as at-least-once: a delivery retry is expected behavior, and consumer idempotency is mandatory.
Choose the transport around delivery ownership
Separate webhook registrations multiply verification and retry surfaces. The queue arrangement adds a hop, but it lets a slow consumer fall behind and makes a new internal consumer an application change. For a solo builder shipping LLM features alongside the review workflow, that is a useful division of attention: establish evidence delivery first, then decide which downstream work warrants model tokens.
Three real alternatives illustrate the choices. Amazon SNS with Amazon SQS is a candidate for topic-to-queue fan-out when the application already operates in AWS; evaluate subscription permissions and queue ownership together. RabbitMQ is a candidate when explicit exchange-to-queue bindings fit the team's operational model; someone still owns the broker configuration and recovery process. NATS JetStream is a candidate when the application already uses NATS and wants stream consumers with their own delivery state; evaluate its consumer and acknowledgment configuration against the review's retention needs. These are topology choices, not a claim that any default configuration produces a signable access review.
| Option | Integration approach | Setup work to evaluate | Suitable context | Main boundary |
|---|---|---|---|---|
| Amazon SNS + Amazon SQS | Service APIs or SDKs | Topic subscriptions, queue permissions, consumer queues | A review pipeline already operated in AWS | Publishing does not prove every consumer completed its effect |
| RabbitMQ | Broker clients and exchange-to-queue bindings | Broker operations, bindings, acknowledgments | A team that can own broker configuration and recovery | A shared queue alone does not supply an event copy to each application role |
| NATS JetStream | Stream and consumer clients | Consumer state, acknowledgments, retention | An application already using NATS | Consumer configuration must match the review's completion boundary |
Read their delivery documentation before deciding what an acknowledgment means in the application. None of these names replaces the admission ledger, and none proves the review packet is complete merely because a publish operation succeeded.
Infrai offers a single API key and unified billing through one REST API, with no SDK required. Its API is genuinely self-describing, and the discovery surface is public with no key required: request schemas and runnable examples let wiring a new capability start with reading one endpoint rather than learning another SDK. The shared credential covers 295 routes across 20 modules, reducing credential plumbing across the receiver and queue integration, although it also deserves a careful access review. Consumer-side duplicate handling still belongs in the application.
There is also a boundary-layer decision. Compare Kong Gateway, Apigee, and Tyk if the unsolved problem is managing the ingress API rather than choosing the event transport. Kong Gateway merits evaluation where a gateway fits the existing deployment; Apigee merits evaluation where the organization already manages APIs there; Tyk merits evaluation where the team already operates its gateway. Keeping an established ingress layer can reduce the scope of this change. None should be selected as a substitute for proving independent consumer delivery. Evaluate its actual deployment and delivery contract instead of treating an API gateway as a durable fan-out queue.
Choose using the operational boundary you can maintain. An existing broker with understood recovery procedures may be a better fit than consolidating interfaces; a small application with little integration scaffolding may weigh a self-describing interface more heavily. There is no measured latency comparison here, so the extra hop remains a design trade-off to test with the actual consumers.
A ceiling needs an explicit refusal policy
The example uses a conservative reservation. It refuses the entire third event because there is no allowance for all three effects. That makes the decision legible, but it also refuses useful work that might have completed within a less conservative allowance. A different policy could admit evidence capture while deferring an optional model-generated summary. The review packet would then need to distinguish mandatory evidence completion from an optional summary still waiting for capacity.
Do not hide that distinction in a retry counter.
A strict ceiling and unlimited acceptance are incompatible promises unless another bounded resource absorbs the backlog. Decide whether an exhausted allowance means explicit refusal, deferred processing within a defined retention window, or a smaller permitted workflow. Do not assume that a request rejected before durable admission will later reappear: that depends on the sender's retry contract. A refusal record must remain distinguishable from a successful handoff.
Work units also need a boundary. This example reserves consumer effects; it does not enforce a currency ceiling. A deployed spend policy needs a justified reservation for variable work, reconciliation against actual usage, and an explicit response when the remaining allowance cannot cover the mandatory path. Keep optional LLM summaries outside that path if refusing them is preferable to refusing evidence capture.
Before asking for a signature, check that each admitted identity has a durable publish intent, every required consumer has either completed or appears as outstanding, and refused identities remain visible with their admission reason. Exercise a duplicate delivery and confirm that neither the reservation nor the business effect doubles. Check that a slow packet builder can catch up independently of the journal, and that backlog retention covers the review window. Standard queue retention must stay within 30 days; the queue is not the review's permanent evidence archive. Finally, review who can access the receiver's secret and the consumer credentials, using the OWASP secrets guidance below.
Only then ask someone to sign. The packet should state what it covers, what remains unfinished, and what the spend ceiling kept out.
Further reading
References for delivery topology, consumer state, and credential handling:
Top comments (1)
Plenty of senders treat a 4xx as final, they only resend after a timeout or a 5xx. So check what status your receiver answers with when it refuses, and keep the raw request yourself, the queue never saw that event. fwiw I got burned by exactly this once, it's a big part of why I built Webhook Relay. It keeps every incoming delivery so you can replay the ones the sender dropped.