Typescript
@upstash/kafka
You can find the Github Repository here.
Installation
Quickstart
- Go to upstash and select your cluster.
- Copy the
REST API
secrets at the bottom of the page
Produce a single message
Produce multiple messages.
The same options from the example above can be set for every message.
Consume
The first time a consumer is created, it needs to figure out the group coordinator by asking the Kafka brokers and joins the consumer group. This process takes some time to complete. That’s why when a consumer instance is created first time, it may return empty messages until consumer group coordination is completed.
More examples can be found in the docstring
Commit manually
While consume
can handle committing automatically, you can also use
Consumer.commit
to manually commit.
Fetch
You can also manage offsets manually by using Consumer.fetch
Examples
See examples as well as various examples in the docstrings of each method.