Documentation ¶
Index ¶
- func Run(ctx context.Context, options ...Option) error
- type Config
- type ErrorListenerFunc
- type Option
- func BindSports() Option
- func BindVirtuals() Option
- func BufferedConsumer(consumer pipe.ConsumerStage, buffer int) Option
- func Callback(cb func(m *uof.Message) error) Option
- func Consumer(consumer pipe.ConsumerStage) Option
- func Credentials(bookmakerID, token string) Option
- func Fixtures(to time.Time) Option
- func Global() Option
- func Languages(langs []uof.Lang) Option
- func ListenErrors(listener ErrorListenerFunc) Option
- func Recovery(pc []uof.ProducerChange) Option
- func Replay(cb func(*api.ReplayAPI) error) Option
- func Staging() Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { BookmakerID string Token string Fixtures time.Time Recovery []uof.ProducerChange Stages []pipe.InnerStage Replay func(*api.ReplayAPI) error Env uof.Environment Staging bool BindVirtuals bool BindSports bool Languages []uof.Lang ErrorListener ErrorListenerFunc }
Config is active SDK configuration
type ErrorListenerFunc ¶
type ErrorListenerFunc func(err error)
ErrorListenerFunc listens all SDK errors
type Option ¶
type Option func(*Config)
Option sets attributes on the Config.
func BufferedConsumer ¶
func BufferedConsumer(consumer pipe.ConsumerStage, buffer int) Option
BufferedConsumer same as consumer but with buffered `in` chan of size `buffer`.
func Callback ¶
Callback sets handler for all messages.
If returns error will break the pipe and force exit from sdk.Run. Can be called multiple times.
func Consumer ¶
func Consumer(consumer pipe.ConsumerStage) Option
Consumer sets chan consumer of the SDK messages stream.
Consumer should range over `in` chan and handle all messages. In chan will be closed on SDK tear down. If the consumer returns an error it is handled as fatal. Immediately closes SDK connection. Can be called multiple times.
func Credentials ¶
Credentials for establishing connection to the uof queue and api.
func Fixtures ¶
Fixtures gets live and pre-match fixtures at start-up.
It gets fixture for all matches which starts before `to` time. There is a special endpoint to get almost all fixtures before initiating recovery. This endpoint is designed to significantly reduce the number of API calls required during recovery.
Ref: https://docs.betradar.com/display/BD/UOF+-+Fixtures+in+the+API
func Languages ¶
func Languages(langs []uof.Lang) Option
Languages for api calls.
Statefull messages (markets, players, fixtures) will be served in all this languages. Each language requires separate call to api. If not specified `defaultLanguages` will be used.
func ListenErrors ¶
func ListenErrors(listener ErrorListenerFunc) Option
ListenErrors sets ErrorListener for all SDK errors
func Recovery ¶
func Recovery(pc []uof.ProducerChange) Option
Recovery starts recovery for each producer
It is responsibility of SDK consumer to track the last timestamp of the successfully consumed message for each producer. On startup this timestamp is sent here and SDK will request recovery; get all the messages after that ts.
Ref: https://docs.betradar.com/display/BD/UOF+-+Recovery+using+API