zauberlabs/gnip4j

Handling of Gnip Compliance 2.0 Stream

Closed this issue · 5 comments

The JSON format for compliance events has changed from Gnip 1.0 to Gnip 2.0. This prevents gnip4j from deserializing the stream properly.

The old format:

{
    "objectType": "activity",
    "verb": "delete",
    "object": {
        "id": "tag:search.twitter.com,2005:780997295722627072"
    },
    "actor": {
        "id": "id:twitter.com:4500096554"
    },
    "timestampMs": "2016-09-28T05:08:14.483+00:00"
}

The new format:

{
    "delete": {
        "status": {
            "id": 666590812910694401,
            "id_str": "666590812910694401",
            "user_id": 205634580,
            "user_id_str": "205634580"
        },
        "timestamp_ms": "1475038917641"
    }
}

From what I can see in the code, fixing this might involve changing out what type of FeedProcessor is constructed in the DefaultGnipStream (or perhaps having a different GnipStream implementation) for the compliance stream. The FeedProcessor would need to coerce the new compliance format into the new format. For reference, the new possible objects on the stream are described here: http://support.gnip.com/sources/twitter/data_format.html#SamplePayloads

Looks like I didn't fully upgrade to 2.0.0 release yet. I'll do that and post back whether or not that fixes it.

Ok, looks like I need to write an Unmarshaller to support this. I'm going to take a stab at doing this as a pull request and will submit soon.

Cool. As far as I know there is no patch floating around to support compliance stream for Gnip 2.0.

I added a pull request for this: #55

Shipped in version 2.1.0 (in a couple of hours will be available at Maven Central)