Migration from older version

This is a guide for migrating from Record Fetcher 1.0 to the new sports feed. This guide highlights the differences between the old record fetcher library and the new sports feed client. Users should be familiar with the existing record fetcher library and its concepts.

New Features

More Sports

Tennis and basketball have been added to the data feed. The new sports are accessible via the sports feed client


    FeedView<TennisMatch> tennisView = client.view(TennisMatch.class);
    FeedView<BasketballMatch> basketballView = client.view(BasketballMatch.class);

There are multiple API levels. You can use the specific sport API


    TennisMatch tMatch = ...;
    String p1 = tMatch.playerOne();
    String p2 = tMatch.playerTwo();

    SoccerMatch sMatch = ...;
    String host = sMatch.host();
    String guest = sMatch.guest();

    BasketballMatch bMatch = ...;
    String host = bMatch.host();
    String guest = bMatch.guest();

    SoccerEventState soccerState = .... ;
    soccerState.getHostPoint(); // specific to soccer

    TennisEventState tennisState = ..... ;
    tennisState.getP1CurrentGameWon();  // specific to tennis

or use generic level, such as IB2Match or IBetMatch.

Matches

In the old record fetcher, odds were contained within event objects. A single event contains all information about the match and the category of bets. For example, a single soccer match could have 2 events: a Brazil vs Japan event with odds that bet on the main score and a separate Brazil vs Japan event containing bets on the total number of corners. There was no simple way to associate these 2 events as records belonging to a single match fixture.

The new sports feed instead maintain three layer of data: match, event and record. In future, all events of the same match will be published by our feed under the same match instance, this help user relates different events easier.

Match information such as league, host and guest are moved into the match object instead of residing at the event object like previously. Event objects now contain event types and live state information related to the event.

Filters

The new sports feed now supports a more advanced filtering model. On top of the existing sportbook and odd type filters, users can now filter records based on sport type, pivot type, league/host/guest names and many other attributes in the records.

Deprecated Features

Refresh Events

Refresh events are no longer emitted to push handlers. It was used previously to let users know a certain set of records is still valid. We now implement TTL and when records expire, delete events are emitted to let users remove the invalid records.

What’s Changed

This section highlights other differences between sports and record fetcher library.

Feed Entry Point

The starting component that clients interact with has changed from DeltaCrawlerSession to SportsFeedClient.

Views

In the past, applications can get feed data directly from DeltaCrawlerSession. However, a single crawler session cannot support multiple views on the data.

In order to accomodate filtering features, we have added views to the feed. To retrieve data, a view with filters has to be created first. Existing applications which do not need filters can simply create a view with no filter


    FeedView<SoccerMatch> view = client.view(SoccerMatch.class);

Polling

Users, who polls for the latest feed snapshot through calling .getAllEvents() on the crawler session, should now switch to calling .snapshot() on the views.


    Collection<SoccerEvent> snapshot = crawlerSession.getAllEvents(); // Old way

    ISnapshot<SoccerMatch> snapshot = view.snapshot(); // New way

Subscribing to Events

Old record fetcher didn’t handle multiple sport, and its DeltaEventHandler is concrete. In the new sport feed, the push handler is now parameterized. The parameterization defines the shape of records emitted to the callback handler.

The handlers now contains callback methods for matches, events and records instead of just having methods for events and records. It also contains methods for state notifications.

In previous record fetcher, it is impossible to get the correct snapshot corresponding to a delta. Now, you can access snapshot that was created by the delta by calling its after() method.


    /** Similarly, you can do this in other data notification methods, e.g. onInsertEvent, onUpdateOdd, etc... */
    @Override
    public void onInsertMatch(InsertMatch<M> insertMatch) {

        // retrieve the full snapshot that is the result of applying this insertMatch command to the current snapshot
        ISnapshot<M> s = insertMatch.after();
    }