What do I do if my Connect data stream is interrupted? Am I able to resume from the point at which the interruption occurred?
There may be interruptions in the Connect data stream from time to time because Urban Airship's services depend on the Internet, which isn't always reliable. When this happens, you will probably want to resume the stream from the point at which it experienced the interruption. Fortunately, Connect allows you to resume a stream through the use of offsets.
What are offsets?
Instead of using timestamps, Urban Airship uses offsets. Offsets do not specify a particular time; rather, they denote a specific event in the data stream. Events include app opens, push notification sends, app closes and more. Therefore, if your data stream was interrupted on July 14th, 2016 at 10:00 am, you wouldn't start from that time (nor are you able to in our API). You would enter the last offset available at the time of the interruption. The stream would then resume at the event that happened after the offset you specified.
- Consider a scenario where the Connect data stream is interrupted, and the last piece of data that was processed has the offset '1245'. If you then chose to resume the stream from the offset '1245', the event '1246' would be the first event to show up when resuming the stream.
Offsets are a better way of tracking events than time stamps because multiple events might be processed at the same exact time. By assigning numbers to each event, we can ensure that all data is accounted for and give Connect a specific point at which to resume the stream.
How do I use offsets?
Offsets are used in place of start in a Connect API request. If you wanted to start a data stream from either the earliest or latest point in your application's data window, you would then set the value of start to either EARLIEST or LATEST. The data window holds the last seven days worth of information for your app, or up to 100GB worth of data. For example, if the value of start was EARLIEST, it would go to the beginning of the 100GB worth of data, or the start of the first day of data in the window. Our Connect API Reference provides examples on where offsets/start are specified in a Connect API request. It also includes a complete lists of events that Connect processes.