Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
Is there a way for the consumer the get the n last messages with KafkaJS?

im new to Kafka and KafkaJS.

Im trying to find a way to get the last n messages sent to a topic, instead of getting all non-consumed messages of that topic.

For example, I have a producer that produces 1 message per second and let it wait for 5 seconds.

Then, when I start the consumer, the consumer gets all 5 messages. ( Only 1 consumer running, 1 group, 1 partition, same topic as producer ).

Is there a configuration on KafkaJS to get only the last n produced messages?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You could poll a single record, or otherwise list the offsets of the topic beforehand.

Then you can seek a consumer to high_offset - N and start polling from there

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!