Skip to content

Settlements

FeedHub settles the accepted Over 2.5 bet as Win. The placement, status lookup and result delivery all refer to FeedHub bet ID 019a2b3c-5000-7000-8000-000000000001 and client key example-over-2-5-001. An event finishing or being withdrawn changes the feed view. Settlement comes from the bet’s own result.

Concept gRPC Canonical RabbitMQ
Placement outcome PlaceBetReply.outcome is PLACE_BET_OUTCOME_ACCEPTED BetPlacementReply.outcome is Accepted
Bet state GetBetsReply.bets[].state moves from BET_STATUS_STATE_OPEN to BET_STATUS_STATE_SETTLED BetStatusReply.bets[].state moves from Open to Settled
Settlement result SETTLEMENT_RESULT_WIN in BetStatus.result or SettledBet.result Win in BetStatusEntry.result or BetResult.result

A status entry carries a placement outcome when its state is NotPlaced. An accepted bet can be Open while FeedHub is still checking for a result, or Expired when it has stopped checking without a result. A Settled entry contains result and settledAt (settled_at in gRPC) for the recorded settlement.

gRPC GetBetsReply when FeedHub has recorded the win at 2026-10-22T19:55:00.35Z.

Protobuf text format
bets {
bet_id: "019a2b3c-5000-7000-8000-000000000001"
client_bet_key: "example-over-2-5-001"
state: BET_STATUS_STATE_SETTLED
result: SETTLEMENT_RESULT_WIN
settled_at { seconds: 1792698900 nanos: 350000000 }
}

Call ReadBetResults on Edge gRPC. Each BetResultDelivery wraps the SettledBet plus an opaque delivery_id for this delivery. Edge receives the corresponding canonical BetResult from the client entry’s RabbitMQ results queue.

Decoded RabbitMQ BetResult body as received by Edge.

{
"schemaVersion": 1,
"betId": "019a2b3c-5000-7000-8000-000000000001",
"clientBetKey": "example-over-2-5-001",
"result": "Win",
"settledAt": "2026-10-22T19:55:00.35Z"
}

gRPC BetResultDelivery for the same result.

Protobuf text format
delivery_id: "YmQ3OWI5ODFjMmMzNDUyNjhiYTI3Y2Y2N2U1NDBhODB8MQ"
result {
bet_id: "019a2b3c-5000-7000-8000-000000000001"
client_bet_key: "example-over-2-5-001"
result: SETTLEMENT_RESULT_WIN
settled_at { seconds: 1792698900 nanos: 350000000 }
}

Results have at-least-once delivery. An unconfirmed result can return after a stream ends or Edge restarts. Redelivery uses the same bet_id with a new delivery_id.

  1. Use bet_id as the deduplication key. Record the result and commit its application with the record that marks it applied.
  2. Confirm the current delivery after your durable write succeeds. If the bet result was applied on an earlier delivery, skip the duplicate write and confirm the current delivery.
  3. Pass the opaque delivery_id to ConfirmBetResult on the same gRPC channel as ReadBetResults while its stream is open. The confirmation must reach the Edge replica holding the delivery. That replica acknowledges the corresponding RabbitMQ delivery on its broker channel.

gRPC ConfirmBetResultRequest for the delivery shown above.

Protobuf text format
delivery_id: "YmQ3OWI5ODFjMmMzNDUyNjhiYTI3Y2Y2N2U1NDBhODB8MQ"

If you missed a result or confirmed it before retaining it, use GetBets with the bet ID or client key to recover the recorded settlement.