I'm trying to select between pulsar and kafka for an event sourcing/cqrs scenario, so one very important feature for these kind of systems is to replay messages from a time point or offset.
With Kafka is simple, you just have to indicate from what point to start consume, or simply seek from a start point.
But pulsar works different, in addition to the consumer interface it has another one called read interface for reading messages from an start point, like beggining or id, but it doesn't work with partitioned topics.
My question is, how can I read from a partitioned topic on Pulsar? could I specify a start point to a consumer since read interface doesn't work for partitioned topics?
I'm testing these features on nodejs clients, so let me know if I'm lossing some feature because of that
If you need to read from a specific partition, put this when setting the topic on the consumer:
.topic(yourTopicName-partition-N)
Where yourTopicName
is a partitioned topic and N
the required partition to read from.
In node.js
format, it should look like this, f.e, if you want to read from partition 1:
const consumer = await client.subscribe({
topic: 'mytopic-partition-1',
subscription: 'my-subscription',
});