Betting and settlements
Bet placement, bet status and settlement delivery require a betting-enabled FeedHub client identity. All payloads here use schema version 1. Use the AMQP login’s exact username as the basic user-id on both requests. FeedHub scopes bets to that identity. See Direct Reply-To for the request frame, response address and request ID.
Place a bet
Section titled “Place a bet”Publish to feedhub-bets-<instance> with routing key "" and message URN urn:message:FeedHub.Contracts:BetPlacementRequest. Expect urn:message:FeedHub.Contracts:BetPlacementReply or urn:message:MassTransit:Fault[[FeedHub.Contracts:BetPlacementRequest]] over Direct Reply-To.
| Request field | Type and validation |
|---|---|
schemaVersion |
Integer 1. |
clientBetKey |
String, 1–100 characters. Choose an opaque key once for the placement attempt and persist it locally before publishing. |
marketId, selectionId |
Non-zero UUIDs identifying a canonical market and one of its selections. |
price |
Decimal price string, greater than 1. |
stake |
Decimal stake string, greater than 0. |
acceptPriceChanges |
Boolean stating whether the client accepts a changed price under the placement rules. |
isLive |
Boolean stating whether the request is for live placement. |
requestedAt |
UTC timestamp of the placement request. Use AMQP expiry to bound its time in the queue. |
The clientBetKey is scoped to your FeedHub client identity. FeedHub first checks the key length and that marketId is non-zero. For an existing key, FeedHub compares marketId, selectionId, price and stake, comparing both decimal amounts by value. If all match, FeedHub returns the stored outcome, or Failed with its bet ID while an outcome is pending. Changed compared fields give Conflict. A replay with the same key does not initiate a second placement. Retain the full original request for reconciliation. With a valid key and non-zero market ID, a refusal for selectionId, price or stake can record the key. A deliberately corrected order therefore needs its own key after the original refusal is confirmed.
The reply has schemaVersion (integer 1), clientBetKey (string), outcome (open enum string), optional betId (UUID), optional currentPrice (decimal string for PriceChanged) and optional problem (string for Refused). Check both the reply envelope and the echoed key before accepting it as an answer to the placement.
| Outcome | Meaning |
|---|---|
Accepted |
FeedHub confirmed the bet and returned its canonical bet ID. |
PriceChanged |
The requested price was refused. The reply can give the current price. A separately authorized new placement uses a new key after the original is known to be unplaced. |
Suspended |
The selection or market is suspended and the bet was not accepted. |
Unavailable |
The selected bet could not be placed, for example because the selection cannot be found or the event is ineligible. |
Failed |
The placement attempt failed or FeedHub has no final outcome to replay. A bet ID may be present. The reply can follow a provider timeout or failure to record the outcome, so reconcile the original placement before issuing a new order. |
Refused |
Invalid input or missing sender identity. The reply has no bet ID. A validation problem can name ClientBetKey, MarketId, SelectionId, Price or Stake. |
Conflict |
One of the compared fields differs from an existing use of the key. The reply has no bet ID. |
Unrecognized |
Unsupported outcome. Reconcile the original placement before any new action. |
A request without an envelope response address is dropped. With an identified sender, FeedHub faults versions above 1. Broker refusal, an unreadable reply, a fault, a disconnect or a deadline can leave the business outcome uncertain. Look up the persisted key or known bet ID with bet status. If reconciling by resubmission, reuse the original key and request terms, with a new envelope requestId. A lookup returning NotFound can precede processing of an earlier request. Keep the original key while the outcome remains uncertain.
For placement, keep the broker queue TTL short enough to avoid stale queued orders and allow the local reply deadline to cover queueing plus processing. Edge’s default placement message TTL is three seconds and its default request deadline is 15 seconds. The publish confirm only answers whether the broker handled the publication.
Example sandbox publish with a three-second expiry.
basic.publish exchange=feedhub-bets-sandbox routing-key="" mandatory=truecontent-type: application/vnd.masstransit+jsondelivery-mode: 2reply-to: amq.rabbitmq.reply-touser-id: sample-clientexpiration: 3000{ "requestId": "01967fb0-0a00-7000-8000-000000000301", "responseAddress": "rabbitmq://broker.feedhub.example:5671/amq.rabbitmq.reply-to", "messageType": ["urn:message:FeedHub.Contracts:BetPlacementRequest"], "message": { "schemaVersion": 1, "clientBetKey": "sample-ticket-001", "marketId": "01967fb0-0a00-7000-8000-000000000003", "selectionId": "01967fb0-0a00-7000-8000-000000000006", "price": "1.85", "stake": "2.00", "acceptPriceChanges": false, "isLive": false, "requestedAt": "2026-11-30T10:03:00Z" }}{ "requestId": "01967fb0-0a00-7000-8000-000000000301", "messageType": ["urn:message:FeedHub.Contracts:BetPlacementReply"], "message": { "schemaVersion": 1, "clientBetKey": "sample-ticket-001", "betId": "01967fb0-0a00-7000-8000-000000000311", "outcome": "Accepted", "currentPrice": null, "problem": null }}Bet status
Section titled “Bet status”Publish to feedhub-settlements-<instance> with routing key "". The URNs are urn:message:FeedHub.Contracts:BetStatusRequest, urn:message:FeedHub.Contracts:BetStatusReply and urn:message:MassTransit:Fault[[FeedHub.Contracts:BetStatusRequest]]. Use Direct Reply-To with user-id and expiry. This exchange accepts queries. Settlement deliveries use the separately provisioned results queue.
Send schemaVersion and both betIds (UUID array) and clientBetKeys (string array), using an empty array for an unused selector. Supply 1–100 entries combined. Each key has 1–100 characters. FeedHub treats an explicit null array as empty. A missing field can fail to bind. FeedHub scopes lookups to the authenticated requester. A request missing the response address, sender or valid selector limits can go unanswered. A version above 1 faults after binding and sender resolution.
The reply contains schemaVersion and bets (array). Each element answers one selector, in input order with all bet IDs first and all keys second. Repeated selectors can produce repeated entries. A known bet entry includes betId (UUID) and clientBetKey (string). For NotFound, only the requested identifier is populated. Entries have required state (open enum string) and optional outcome (placement outcome), currentPrice (decimal string), result (settlement result) and settledAt (UTC timestamp).
| State | Meaning and additional fields |
|---|---|
NotFound |
FeedHub found no matching bet for this client. |
Placing |
The key was recorded and an outcome has yet to be stored. |
NotPlaced |
FeedHub recorded a non-accepted placement. The placement outcome is present, with currentPrice when applicable. Reconcile an ambiguous downstream outcome before replacing an order whose stored outcome is Failed. |
Open |
Accepted and still unsettled within the configured status horizon. |
Settled |
The stored settlement is available as result, with settledAt when recorded. |
Expired |
Accepted, still unsettled and its event starts at or before the configured read horizon (14 days before the query by default). This state carries no settlement. |
Unrecognized |
Unsupported state. Retain the original bet identity and avoid inferring an outcome. |
An unanswered, malformed or unrelated reply leaves status unconfirmed. Retry a status read with a fresh request ID and the same selector and identity. Compare the reply’s entry selectors and schema before applying the result.
Example request to feedhub-settlements-sandbox using the Direct Reply-To properties with expiration: 5000.
{ "requestId": "01967fb0-0a00-7000-8000-000000000302", "responseAddress": "rabbitmq://broker.feedhub.example:5671/amq.rabbitmq.reply-to", "messageType": ["urn:message:FeedHub.Contracts:BetStatusRequest"], "message": { "schemaVersion": 1, "betIds": [], "clientBetKeys": ["sample-ticket-001"] }}{ "requestId": "01967fb0-0a00-7000-8000-000000000302", "messageType": ["urn:message:FeedHub.Contracts:BetStatusReply"], "message": { "schemaVersion": 1, "bets": [ { "betId": "01967fb0-0a00-7000-8000-000000000311", "clientBetKey": "sample-ticket-001", "state": "Settled", "result": "HalfWin", "settledAt": "2026-11-30T12:30:00Z" } ] }}Settlement delivery
Section titled “Settlement delivery”FeedHub publishes a persistent urn:message:FeedHub.Contracts:BetResult to <client>-feedhub-<instance>-bet-results with routing key "", AMQP content type and a basic message-id matching the envelope messageId. The provisioned same-name durable queue has no replica suffix. Consume it with manual acknowledgement and bounded prefetch. This delivery has no Direct Reply-To exchange or business reply.
| Payload field | Type and use |
|---|---|
schemaVersion |
Integer 1. |
betId |
Canonical bet UUID. Use it with the client identity for durable deduplication. |
clientBetKey |
String used at placement. Match it to the original bet. |
result |
Open enum string. Win, Loss, Void, HalfWin and HalfLoss are known values. |
settledAt |
UTC timestamp of settlement. |
Prepare for redelivery and repeated publication. FeedHub can retry publication with a new transport message ID for the same bet result. Acknowledge only after validating the result and recording or verifying its effects in durable client state. An unknown result can be preserved for manual handling and acknowledged after handoff is durable. Edge holds unsupported, wrong-type and unreadable results unacknowledged. When a stream ends, the broker returns its unacknowledged deliveries to the queue. A direct client should preserve such results for investigation or a compatible reader.
Example delivery from sample-client-feedhub-sandbox-bet-results with the empty routing key and channel delivery tag 42.
content-type: application/vnd.masstransit+jsondelivery-mode: 2message-id: 01967fb0-0a00-7000-8000-000000000312{ "messageId": "01967fb0-0a00-7000-8000-000000000312", "messageType": ["urn:message:FeedHub.Contracts:BetResult"], "message": { "schemaVersion": 1, "betId": "01967fb0-0a00-7000-8000-000000000311", "clientBetKey": "sample-ticket-001", "result": "HalfWin", "settledAt": "2026-11-30T12:30:00Z" }}-
Decode and check the result, then apply it atomically with its deduplication record under the client identity and bet ID. A conflicting result needs review before acknowledging.
-
If state already reflects the same result, verify the durable record and skip the repeated side effect.
-
On the current delivering AMQP channel, confirm this delivery only.
basic.ack delivery-tag=42 multiple=false
If the channel closes before acknowledgement, process the redelivery by inspecting durable state and acknowledge its new delivery tag on the new channel. Use the bet ID to identify the settlement across deliveries and the delivery tag to acknowledge the current delivery.