Explore this guide
A feed connection receives messages. An odds feed ingestion pipeline turns those messages into a market view that the platform can interpret, recover and audit.
The hard part is preserving meaning through mapping, queues, incremental updates and restarts. A quickly delivered price can still belong to the wrong market or an incomplete local state.
This guide focuses on implementation. The architecture and examples are illustrative; provider-specific behaviors are linked to official documentation.
Pipeline flow
- 01Provider adapter
Authenticate, subscribe and decode the source protocol
- 02Mapping + validation
Resolve event, market and outcome identity
- 03RabbitMQ / Kafka
Route or retain events with explicit ordering
- 04State processor
Apply snapshots, updates and duplicate guards
- 05Redis read model
Publish versioned prices, status and health
- 06API + operations
Deliver updates and monitor recoverability
Separate transport handling from market-state reconstruction. A useful boundary is receive → validate → map → process → publish, with recoverable checkpoints between the appropriate stages.
What each stage owns
- Adapter: Authentication, subscriptions, decoding and provider recovery tokens.
- Mapper: Event, market, outcome, period and line identity.
- Processor: Ordered updates, duplicate handling and snapshot reconstruction.
- Read model: Prices, market status, continuity and feed health.
- Delivery: Your API or WebSocket view, with its own reconnect behavior.
Keep result corrections and settlement events traceable as well. A price cache is not the financial settlement record.
Normalize identity without losing provider meaning
An internal schema reduces transport differences. It must still preserve source identity, market rules and update semantics.
| Internal field | Example | Why retain it? |
|---|---|---|
| Source identity | provider-A / producer-live | Route health and recovery to the correct source |
| Event mapping | external-471 → event-42 | Trace the fixture match |
| Market identity | total goals / full match / line 2.5 | Prevent merging different periods or lines |
| Outcome | over | Distinguish the two sides of the market |
| Update kind | snapshot / replace / remove | Apply the correct state transition |
| Continuity metadata | source cursor + local generation | Recover without stale-worker writes |
The identifiers above are invented examples. Do not turn a handicap or total line into a display label and discard its structured value.
Mapping needs an exception path
- Match against stable provider IDs and validated cross-provider mappings.
- Use names and start times as review signals, not sole proof of identity.
- Quarantine ambiguous events instead of guessing.
- Keep the original message reference so corrections remain explainable.
An unmapped event is a data-quality exception. It should not become a plausible-looking price on the wrong fixture.
Choose RabbitMQ or Kafka deliberately
Sportradar UOF documents XML delivery through AMQP and RabbitMQ. That is its feed interface; your internal transport is a separate choice. Source: UOF concepts.
| Choice | Useful capability | Design responsibility |
|---|---|---|
| RabbitMQ | Routing events to consumer queues | Confirm publishing, acknowledge at the intended processing boundary and handle redelivery |
| Kafka | Retained log and independent consumers | Choose partition keys, retain enough history and manage offsets |
| Direct adapter-to-processor | Fewer moving parts | Provide explicit buffering, recovery and overload behavior |
RabbitMQ acknowledgements and publisher confirms cover different messaging steps. A lost confirmation can lead to retransmission, so consumers must tolerate duplicates. Source: RabbitMQ reliability.
For Kafka, key related updates consistently by provider and market, or by event where cross-market ordering is required. Ordering is within a partition; worker concurrency must preserve it. Source: Kafka design.
Apply snapshots and updates at the right scope
A snapshot initializes the relevant local state. Subsequent messages may replace a value, remove it or replace an entire market image.
Sportradar UOF odds_change can include a subset of markets. Omitted markets remain unchanged; included markets contain their current outcomes and odds. Source: message structure.
Worked update example
Assume a fictional provider defines available size as a replacement value:
| Step | Incoming instruction | Correct local amount at 2.04 |
|---|---|---|
| Initial image | Store 1,800 | 1,800 |
| Update A | Replace with 1,000 | 1,000 |
| Redelivery of A | Same update identity | 1,000 |
| Update B | Remove price level | No level present |
Adding 1,000 to 1,800 invents liquidity. Applying A after B can resurrect a removed offer unless the ordering and duplicate guards prevent it.
Sequence numbers are not timestamps
A documented sequence can establish continuity within its scope. An opaque cursor supports the provider's resume process. A timestamp describes time; it is not automatically a gap detector.
When continuity is uncertain, invalidate the affected reconstruction and recover it. Do not invent counter arithmetic for tokens the provider defines as opaque.
Publish a verified Redis read model
Store the current reconstructed market view in Redis, including status, source timestamps, continuity metadata and the active recovery generation.
An illustrative key is odds:{provider}:{marketId}. Financial transactions and order history belong in durable records outside this replaceable cache.
Prevent stale writers
When recovery starts, assign a new local generation. Every write checks that generation and the relevant update ordering before replacing state.
Redis WATCH with MULTI/EXEC supports optimistic locking for guarded read-modify-write operations. Re-read and recompute after an aborted transaction. Source: Redis transactions.
Handle the write/checkpoint boundary
Apply the update before committing the consumer checkpoint. If a crash occurs between them, replay must produce the same state rather than a second business effect.
If Redis loses its contents after a checkpoint advances, rebuild from a supported snapshot or retained log. Committed consumption is not evidence that the cache survived.
Detect degradation and recover safely
Track producer health, continuity, publication age and local processing delay separately. A quiet price ladder can be legitimate; an unresolved sequence gap cannot be ignored.
- Restrict decisions that depend on the affected state.
- Reconnect with bounded backoff and jitter, respecting provider limits.
- Resume through the documented cursor or request a fresh snapshot.
- Process the recovery to its completion boundary.
- Publish the validated generation and restore only eligible markets.
Sportradar recovery can deliver current odds without reproducing every intermediate price change. Its sequence ends with snapshot_complete; handle repeats safely. Source: UOF recovery.
Worked restart scenario
Suppose a worker stores update A and crashes before committing its offset. Its replacement receives A again.
The acceptance test is one resulting market state, with no invented liquidity. Then simulate Redis loss: the replacement must rebuild before reporting that state as ready.
Multi-provider handover and corrections
Assign source ownership by event, market or product. A fallback needs compatible definitions, permitted usage and a validated starting state.
- Do not combine one provider's snapshot with another provider's deltas.
- Record the source transition and reset continuity at the appropriate scope.
- Define which source owns results and how corrections are approved.
- Keep exchange order reconciliation separate from odds-provider failover.
Provider diversity can improve coverage. It also adds mapping and disagreement paths that require tests.
Acceptance tests and monitoring
| Failure injected | Result to verify |
|---|---|
| Duplicate update | Same state after reprocessing |
| Missing or invalid continuity | Restricted state until recovery completes |
| Unknown event mapping | No publication to an unrelated fixture |
| Old worker after recovery | Its write is rejected |
| Queue backlog | Processing delay is visible and affected actions follow policy |
| Redis loss | Snapshot or replay rebuilds the read model |
Monitor mapping failures, consumer lag, processing delay, recovery duration and blocked writes. Set thresholds from provider cadence and product requirements, not an unsupported universal latency figure.
For the next stage, see the live in-play acceptance architecture. This pipeline supplies state; that service decides how a new bet is handled.
Frequently asked questions
Select a question to open its answer. Opening another closes the previous one.
Do we need Kafka for every odds feed?
No. A retained log is useful when replay and independent consumers justify it. A smaller integration can use fewer components if it still has explicit continuity, recovery and overload handling.
Can provider timestamps replace sequence numbers?
Not automatically. Follow the provider's continuity contract. Timestamps can help assess age, but may not expose missing messages or establish ordering between independent sources.
Should we store raw provider messages?
Retain enough evidence for permitted debugging and replay, with access controls and retention limits. Confirm the provider's storage rights before archiving a feed.
Does a short Redis TTL guarantee correctness?
No. A key can contain an incorrectly reconstructed or stale market before it expires. Validate health, continuity and the active recovery generation separately.
What should happen to an unmapped market?
Hold it for mapping review with its source identifiers. Do not match it by a similar-looking name and publish it automatically.
Can we drop old messages when a queue grows?
Only if the message contract and reconstruction method make that safe. Dropping an incremental update can invalidate the cache; durable order and settlement events need their own handling.
How do we prevent an old worker overwriting recovery?
Use a recovery generation or equivalent ownership guard that is checked atomically when state is written. A local flag in a stopped worker is insufficient.
Is current-state recovery the same as historical replay?
No. A provider may recover the latest valid state without sending every intermediate price. Confirm both capabilities separately.
Further reading
Primary sources
- Sportradar — UOF integration concepts
- Sportradar — Odds change message scope
- Sportradar — Recovery procedures
- Apache Kafka — Design and delivery semantics
- RabbitMQ — Reliability guide
- Redis — Transactions
This update is awaiting technical review.