Your account has two streams, a records stream and an events stream. The records stream contains the latest version of every record across connected APIs. The events stream, on the other hand, contains the latest change events that Sequin emits whenever a record changes.

These streams give you a fast and easy way to build on top of the data that Sequin extracts from the APIs you’ve connected. You can use them to build workflows, pipe data into your application, or sync data to a database.

When to use the Stream APIs

You can use Sequin’s Stream APIs to consume the API data in your records and events streams. These APIs give you a consistent interface to all your data, are easy to use, and let you filter to only the records and events you need. These APIs are also suitable for runtime environments where a persistent connection to a system like Kafka is not feasible (like a lambda function).

Alternatively, you can use one of Sequin’s consumers to forward your API data to destinations like Postgres or Kafka. Sequin’s consumers are pre-built, Sequin-managed clients of the Stream APIs that you can provision with just a few clicks.

If you’re using infrastructure that Sequin’s consumers can connect to, they’re a great option. If you’d prefer to work with your API data with an HTTP interface or want more control, the Stream APIs are the way to go.

The Stream APIs can also be used as a complement to other consumers, as you can use it to perform one-off queries for debugging or testing.

Consuming records and events

To consume from the records or events streams, your application needs to page through unseen items. Sequin offers two different methods for moving through these streams:

  • Paginating with a cursor: With this method, you’ll keep track of your cursor (i.e. pagination token) in the stream. You’ll pass the cursor from your last request in to the next request to get the next page of records or events.
  • Using consumers: With this method, you’ll register a consumer with Sequin. A consumer is like a consumer group in Kafka. You’ll consume records on behalf of a consumer and Sequin’s stream APIs will keep track of your offset for you.

Paginating with a cursor is a simple and easy way to get started. Consumers, on the other hand, take a few more steps to setup but are more powerful. Consumers use the same principles as modern message brokers. This means they enable features like exactly once delivery and parallel consumption.