robertmrk / aiosfstream

Salesforce Streaming API client for asyncio
MIT License
47 stars 31 forks source link

Is there a way to manuallu specify replayId without creating complex instances and implementations of `ReplayMarkerStorage` or 'Mutablemapping' #9

Closed pranayjswl007 closed 5 years ago

pranayjswl007 commented 5 years ago

I just wanna specify replayId when I create an connect , is there an easier way?

robertmrk commented 5 years ago

Hi @pranayjswl007

If you just want to always retrieve new events or all events from the retention window then you can either pass ReplayOption.NEW_EVENTS or ReplayOption.ALL_EVENTS to the replay parameter of the Client. But if you want your client to start retrieving events from the point where it left off then you must pass an object to the replay parameter which either has a MutableMapping or a ReplayMarkerStorage interface. It is explained in the Replay configuration section.

To create a custom ReplayMarkerStorage class, all you have to do is to implement set_replay_marker and get_replay_marker. Or if you don't want to create a custom class for storing replay ids, it doesn't get much simpler then passing a Shelf object to the replay parameter.

joshua-nicholson commented 3 years ago

@pranayjswl007 Did you figure this out? I'm in the same situation as you right now. The docs say you can just use a dict but then don't show what the shape of the dictionary needs to be, so I don't know what to do.