Documentation ¶
Index ¶
- func Run(parentCtx context.Context, options ...Option) error
- type Config
- type ErrorListenerFunc
- type Option
- func BufferedConsumer(consumer pipe.ConsumerStage, buffer int) Option
- func Callback(cb func(m *uof.Message) error) Option
- func ConfigConcurrentAPIFetch(concurrentAPIFetch bool) Option
- func ConfigTLS(isAMQPTLS bool) Option
- func ConfigThrottle(isThrottled bool, prefetchCount int) Option
- func Consumer(consumer pipe.ConsumerStage) Option
- func Credentials(bookmakerID int, token string, nodeID int) Option
- func CustomServers(customAMQPServer, customAPIServer string) Option
- func DisableAutoAck() Option
- func DisablePipeline() 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 { CustomAMQPServer string CustomAPIServer string BookmakerID int Token string NodeID int IsAMQPTLS bool IsThrottled bool PrefetchCount int ConcurrentAPIFetch bool AutoAckDisabled bool PipelineDisabled bool Fixtures time.Time Recovery []uof.ProducerChange Stages []pipe.InnerStage Replay func(*api.ReplayAPI) error Env uof.Environment 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 ConfigConcurrentAPIFetch ¶
ConfigConcurrentAPIFetch for auto-fetching rest api concurrently
func ConfigThrottle ¶
ConfigThrottle is Throttled uses channel.Get internally. prefetchCount is to be used when isThrottled is false
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 CustomServers ¶
CustomServers for establishing custom servers
func DisableAutoAck ¶
func DisableAutoAck() Option
DisableAutoAck requires usage of exposed message functions Ack/NackRequeue/NackDiscard
func DisablePipeline ¶
func DisablePipeline() Option
DisablePipeline disables internal stages for processing markets, fixtures, players
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